Proper way to reload CompositeControl when its state must change after Postback

Discussion in 'ASP .Net Web Controls' started by jeljeljel, Sep 20, 2007.

  1. jeljeljel

    jeljeljel Guest

    I am creating a CompositeControl that contains a Table. The rows in
    the Table are controlled by an internal pager. The control renders
    the pager and the table. When the user clicks the pager, the control
    shows the next set of records in the table.

    Assume after the OnLoad method the control has regenerated to the
    exact state when the last time the page unloaded (with ViewState or
    some other means -- important part is the control's state is the same
    as when the page unloaded). Then the control changed events fire,
    then the post back events fire. A post back event is received from
    the Pager that the user requested a new page.


    So now the CompositeControl must "tear down" the old markup and
    regenerate the new markup.


    Is this as simple as calling Controls.Clear()? There must be more to
    it, b/c when I call Controls.Clear(), the Count becomes 0, and I
    create the new markup (in CreateChildControls). The Count property
    on
    Controls.Count shows new controls have been added, but when the page
    renders, the original markup is what displays.


    Thanks,
    John
    jeljeljel, Sep 20, 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. jeljeljel
    Replies:
    1
    Views:
    1,049
    Teemu Keiski
    Sep 20, 2007
  2. Alex

    Dropdown in webpart lost its state after postback

    Alex, Dec 1, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    427
  3. thunk
    Replies:
    1
    Views:
    292
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    454
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    600
    thunk
    Apr 3, 2010
Loading...

Share This Page