Paul Ryder

Paul Ryder

  • NA
  • 1
  • 0

Problem with Viewstate within Usercontrol for Dynamically added controls

Nov 22 2010 11:04 AM

I'm trying to build a Usercontrol to display a TabContainer, with dynamically added TabPanels, each one having a CheckBoxList within it.
I have created this fine, but on a postback, the page fails with the following error.
Specified argument was out of the range of valid values
I currently assign a Dataset to a property of the user control, which I save into the viewstate.
With the Control population in the page load event, I get  the error directly on the post back, without PL being fired.
With the Control population in the OnInit event, it fires but the viewstate is empty as it's not loaded as yet.
What would you suggect to be able to create the controls and still have the viewstate store and load their values?
 
Many Thanks,
Paul Ryder