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

J

jeljeljel

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top