Last post Sep 30, 2008 09:18 AM by sroebke
Sep 29, 2008 04:11 PM|sroebke|LINK
I am working on my first custom control, and I have it rendering and behaving properly on the client side. However, the use I have for it, it must be added programmatically, and can't be placed in the the aspx file.
The control has a ListItemCollection that contains data added programmatically. When I create the control programmatically in the page_load or createclientcontrol functions, the control loses all data in the listitemcollection, as well as formatting data,
such as the width, on postback. I am trying to find how I can persist this data after a postback. I have been playing around with viewstate but I can't get that working (I assume because when I reinstantiate the object in page_load, the postback info for
the object is lost.)
Any help or points in the right direction would be appreciated.
Sep 29, 2008 06:27 PM|jkirkerx|LINK
You have to create the code behind for the controls in OnInit, and load the listbox items in OnLoad. This will render the controls again on postback, or asyncpostback.
Sep 30, 2008 09:18 AM|sroebke|LINK
Working perfectly now, thank you very much for your help!