Refreshing web control after sub-property change

Discussion in 'ASP .Net Building Controls' started by Bruce Parker, Apr 27, 2004.

  1. Bruce Parker

    Bruce Parker Guest

    I have the following

    A class called PageHeader that derives from WebControl. The PageHeader class defines a property called ForwardButton As ForwardButtonProperties. This ForwardButtonProperties class TypeConvertor is the ExpandableObjectConvertor. I have defined several properties in the ForwardButtonProperties class. These properties all have the NotifyParentProperty(True)attribute.

    Some of these properties affect the generation of the html in the CreateChildControls in the PageHeader class. When a property is changed during the run-time, I want CreateChildControls to be called. The parent property is not notified of the change. What am I missing?
     
    Bruce Parker, Apr 27, 2004
    #1
    1. Advertising

  2. Hi Bruce,

    For a composite control every time you need access to a child control and
    you can't assure it will be already created you need to first call
    EnsureChildControls which will take care of calling CreateChildControls if
    the childs don't exists. Its recommended that you override the Controls
    property get accessor and add a call to EnsureChildControls there before
    returning the controls collection thus making sure that every time anyone
    tries to access the controls by using the controls collection that required
    call is made. In the next version of ASP.NET, there is a new class named
    "CompositeControl" that includes such overload of the Controls property. But
    that won't be available till next year so I think you may opt for coding
    your own ;-)

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

    "Bruce Parker" <> wrote in message
    news:...
    > I have the following:
    >
    > A class called PageHeader that derives from WebControl. The PageHeader

    class defines a property called ForwardButton As ForwardButtonProperties.
    This ForwardButtonProperties class TypeConvertor is the
    ExpandableObjectConvertor. I have defined several properties in the
    ForwardButtonProperties class. These properties all have the
    NotifyParentProperty(True)attribute.
    >
    > Some of these properties affect the generation of the html in the

    CreateChildControls in the PageHeader class. When a property is changed
    during the run-time, I want CreateChildControls to be called. The parent
    property is not notified of the change. What am I missing?
    >
     
    Victor Garcia Aprea [MVP], Apr 28, 2004
    #2
    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. Harlan Messinger

    Self-refreshing and non-self-refreshing controls

    Harlan Messinger, Aug 4, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    486
    =?Utf-8?B?Y2xpY2tvbg==?=
    Aug 4, 2006
  2. Ben
    Replies:
    2
    Views:
    954
  3. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,166
    Lawrence D'Oliveiro
    May 20, 2011
  4. wpy

    how to create sub control within sub control?

    wpy, Apr 7, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    164
    Stefan
    Apr 8, 2004
  5. Harlan Messinger

    Self-refreshing and non-self-refreshing controls

    Harlan Messinger, Aug 3, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    216
    Harlan Messinger
    Aug 3, 2006
Loading...

Share This Page