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. 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. Max2006
    Replies:
    2
    Views:
    517
    Max2006
    Jul 13, 2007
  2. Peter

    properties not showing in properties window at design time

    Peter, Dec 10, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    213
    Lostinet.Web Support
    Dec 10, 2003
  3. Steve Barker

    Properties not persisting at design time.

    Steve Barker, Jan 22, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    154
    Steve Barker
    Jan 22, 2004
  4. KJ
    Replies:
    0
    Views:
    125
  5. Alex Maghen

    Event when Design-Time Properties have been set

    Alex Maghen, Jun 5, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    118
    Steven Cheng[MSFT]
    Jun 6, 2006
Loading...

Share This Page