So I've fought and fought and fought some more, and I've finally got my dynamic DataGrids saving to and loading from viewstate properly... or so I thought.
A quick description of the page. It contains a dynamic # of 4 different types of datagrids. Each row in each datagrid will contain a DropDownList among other controls, so for those columns I used a TemplateColumn that uses a class I created that inherits from ITemplate which adds the DropDownList to the container in ITemplate.InstantiateIn(Control container) method.
So the page loads fine and all my DropDownLists are all full like they should be. However, when I click on my submit button, the page posts back, and all the controls (textboxes and checkboxes) in every row of my datagrid have their correct corresponding data... everything except for the drop down lists, which for some reason have lost their ListItems.
I know there are some fugly work arounds, but I would really like to be able to use the DropDownList.SelectedValue property to be able to find out which item in the drop down list has been selected for each row. It seems like the DropDownList's data must be in ViewState somewhere, but how to have it retrieve that data is eluding me. Any ideas?
A quick description of the page. It contains a dynamic # of 4 different types of datagrids. Each row in each datagrid will contain a DropDownList among other controls, so for those columns I used a TemplateColumn that uses a class I created that inherits from ITemplate which adds the DropDownList to the container in ITemplate.InstantiateIn(Control container) method.
So the page loads fine and all my DropDownLists are all full like they should be. However, when I click on my submit button, the page posts back, and all the controls (textboxes and checkboxes) in every row of my datagrid have their correct corresponding data... everything except for the drop down lists, which for some reason have lost their ListItems.
I know there are some fugly work arounds, but I would really like to be able to use the DropDownList.SelectedValue property to be able to find out which item in the drop down list has been selected for each row. It seems like the DropDownList's data must be in ViewState somewhere, but how to have it retrieve that data is eluding me. Any ideas?