P
Patrick Wilby via .NET 247
From: Patrick Wilby
Hi (this is the second time I've tried to post this message,apologies if the original is now up on the forum)
I have a custom control (inherited from WebControl) that has aproperty which is a collection (inherited from BaseCollection).This collection holds custom controls of type TabPage(inheritedfrom Control). I can set the Caption property for the TabPageobjects once placed onto a web page (the same functionality as aTextBox.Text property). The problem is that the Caption propertyof the TabPage objects are not retained in viewstate on postbackif they are held in the collection. If I place a standaloneTabPage control onto a page and postback the TabPage controlCaption property retains state (I implemented theIPostBackDataHandler interface in TabPage to do this). So howcan I maintain the viewstate of my TabPage objects whilst beingpart of a collection of another custom object? Should I use theIStateManger interface? How would this be implemented i.e. whichobject should it be implemented in, the class that defines mycollection, the TabPage class or the top level custom controlclass, do I need to implement IPostBackDataHandler in my toplevel custom control class? This is my first custom control anda simple code example (VB preferably) and/or explanation of whatto do would be very useful.
Thanks
Patrick
Hi (this is the second time I've tried to post this message,apologies if the original is now up on the forum)
I have a custom control (inherited from WebControl) that has aproperty which is a collection (inherited from BaseCollection).This collection holds custom controls of type TabPage(inheritedfrom Control). I can set the Caption property for the TabPageobjects once placed onto a web page (the same functionality as aTextBox.Text property). The problem is that the Caption propertyof the TabPage objects are not retained in viewstate on postbackif they are held in the collection. If I place a standaloneTabPage control onto a page and postback the TabPage controlCaption property retains state (I implemented theIPostBackDataHandler interface in TabPage to do this). So howcan I maintain the viewstate of my TabPage objects whilst beingpart of a collection of another custom object? Should I use theIStateManger interface? How would this be implemented i.e. whichobject should it be implemented in, the class that defines mycollection, the TabPage class or the top level custom controlclass, do I need to implement IPostBackDataHandler in my toplevel custom control class? This is my first custom control anda simple code example (VB preferably) and/or explanation of whatto do would be very useful.
Thanks
Patrick