Nested propertiies not set at design time from properties window

Discussion in 'ASP .Net Building Controls' started by Gery D. Dorazio, Mar 2, 2007.

  1. Guess my other post was too long. Maybe this is more to the point.

    Here is a composite control...can't get much simpler:

    [ToolboxData("<{0}:TestControl runat=\"server\"></{0}:TestControl>")]
    public class TestControl : CompositeControl
    {
    private TextBox tb = new TextBox();

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
    PersistenceMode(PersistenceMode.InnerProperty),
    NotifyParentProperty(true)]
    public TextBox TextBox
    {
    get { return tb; }
    set { tb = value; }
    }

    protected override void CreateChildControls()
    {
    base.CreateChildControls();
    this.TextBox.ID = "TB1";
    this.Controls.Add(TextBox);
    }

    }


    In an aspx page this can then be done:

    <ewc:TestControl ID="TestControl1" runat="server" >
    <TextBox Height="55"></TextBox>
    </ewc:TestControl>

    When switching to design mode and expanding the "TextBox" property the
    height shows up properly. If I try to change the value from the properties
    window it won't set it in the html. It stays at 55 when switching to html
    mode. Then when switching back to design mode it shows up as 55, the
    original value. In fact this behavior happens for all of the "TextBox"
    properties. None of its properties can be set from the properties window.

    What's wrong with this?
    Does anyone have a solution?


    Thanks,
    Gery
     
    Gery D. Dorazio, Mar 2, 2007
    #1
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.