C
Chris Newby
I have a very simple custom control that derives from WebControls.Panel and
implements INamingContainer.
It appear that controls created as children of my custom control are having
ViewState problems. For example, suppose I create a ListBox control as a
child of my custom control, attach a SelectedIndexChanged event handler to
it, and bind its data in the Page_Load event handler only if the current
request is not a post back. I load the page and initially everything is ok
and the list box has values. If I then select an item in the list box, the
page posts back to the server and thats when things get weird. The event
handler I orginally attached to SelectedIndexChanged doesn't get called and
upon further inspection the ListBox no longer has any items ... meaning they
were not loaded from ViewState.
If I take the ListBox in question *out* of my custom control, it works
perfectly fine. It also works if I put it inside a pure instance of
WebControls.Panel. So clearly something isn't right with my custom control.
I figure its something pretty obvious, but I'm new to custom controls ...
lucky me
Thought?
TIA//
implements INamingContainer.
It appear that controls created as children of my custom control are having
ViewState problems. For example, suppose I create a ListBox control as a
child of my custom control, attach a SelectedIndexChanged event handler to
it, and bind its data in the Page_Load event handler only if the current
request is not a post back. I load the page and initially everything is ok
and the list box has values. If I then select an item in the list box, the
page posts back to the server and thats when things get weird. The event
handler I orginally attached to SelectedIndexChanged doesn't get called and
upon further inspection the ListBox no longer has any items ... meaning they
were not loaded from ViewState.
If I take the ListBox in question *out* of my custom control, it works
perfectly fine. It also works if I put it inside a pure instance of
WebControls.Panel. So clearly something isn't right with my custom control.
I figure its something pretty obvious, but I'm new to custom controls ...
lucky me
Thought?
TIA//