web control properties with child poperties in designer...

Discussion in 'ASP .Net Web Controls' started by Klaus Salchner, Mar 3, 2004.

  1. I have two issues with properties of a web control (like a class) which have
    sub-properties. I want to be able to show these sub-properties on the
    property designer so that the user can change the property values through
    the designer:

    (a) I create my won class like Address which has a Text and Description
    property. These properties have the get/set accessors. Then I have a
    property of the type Address on my control itself, again with the get/set
    accessors. I see the property on the designer, but it is read-only and the
    value is set to the type, e.g. MyControl.PropertyName.

    // PlayerAddress is a complex property whose
    // type is the class Address. Address has four
    // properties, Street, City, State, and Zip. These become
    // subproperties of SoccerPlayer.
    public Address PlayerAddress
    {
    get
    {
    return address;
    }
    }

    (b) I have a composite control which has added childs, like a text control.
    Now I exposed a property TextFont on my control with a get/set accessor. It
    gets/sets the Font property of the text child control. I can see the font on
    the property designer, I can set the values, but they are not persistent. I
    do not see any HTML tags created and when I close the page and open it again
    all the settings are lost. But when I change them I see the rendering on the
    designer change accordingly.

    /// <summary>
    /// the font to use for the tool box description
    /// </summary>
    [Browsable(true),
    Category("ToolBoxItemAppearance"),
    Description("The font of the description control.")]
    public FontInfo DescriptionFont
    {
    get
    {
    // makes sure that all the client controls are created as we need to
    get a reference
    // to the font property of the description control
    EnsureChildControls();

    // returs the font of the description label
    return TheDescriptionLabel.Font;
    }
    }

    So there is something I am doing wrong here. And I can't find any workable
    example. Even the example provided in the documentation shows the behavior
    described in point (a).

    Any help is greatly appreciated. Even if it just pointing to a working
    sample so I can figure out what I need to do.

    Also in case some MS guys read this. When it comes to web controls and the
    more advanced thing you can do - I unfortunately I have to say the
    documentation is lacking - lacking in a big way!

    Regards, Klaus
    -----------------------------------------------
    Klaus Salchner
    email:

    Proud member of
    http://linkedin.com - become part of my professional network; it's a free
    3rd party tool
    http://gotdotnet.com
    http://theserverside.net
    Klaus Salchner, Mar 3, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Rodriguez
    Replies:
    23
    Views:
    1,091
    David Schwartz
    Dec 9, 2003
  2. Max2006
    Replies:
    2
    Views:
    505
    Max2006
    Jul 13, 2007
  3. Alexander Higgins
    Replies:
    3
    Views:
    1,067
    Teemu Keiski
    Jul 30, 2007
  4. Donal McWeeney

    Mixing child properties and child controls - how?

    Donal McWeeney, Feb 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    118
    [MSFT]
    Feb 14, 2005
  5. Alexander Higgins
    Replies:
    0
    Views:
    439
    Alexander Higgins
    Jul 21, 2007
Loading...

Share This Page