>I have a DropDownList in a TemplateColumn, sourced from a DataReader. I'm baffled at how to perist the values of the list on PostBack (without just reinstantiating the DataReader).
>
>The DropDownList is operating fine up to that point. It's bound to the correct data, displays the correct text, and changes are correctly captured into the data. But, on PostBack the list is empty.
>
>I've tried various things, but in its current incarnation, the Aspx definition is:
>
<asp:DropDownList id="cboContractors" DataSource = '<%# this.contractors.ContractorsList ' Value = '<%# TimeSheetsDataSet.Con_ID ' DataTextField = "Company" DataValueField = "ContractorID" DataBinding="con_id" runat="server">
>
>In code, I do the following when the page is initially loaded, and after the page controls are bound:
>
DropDownList ddl = (DropDownList)(TimeSheetDataGrid.Items[0].FindControl("cboContractors"));
>string s = TimeSheetsDataSet.Con_ID;
>ddl.SelectedValue = s;
>...
>Session["cboContractors"] = TimeSheetDataGrid.Items[0].FindControl("cboContractors");
>
>
>On PostBack, no matter what I've tried, the DropDownList is empty. I've saved the control to a session variable, and I save the class (contractor) that the DataSource (contractors.ContractorsList) comes from. On PostBack, I can restore the session variable to a DropDownList control, and the list is okay. But, as soon as the page is displayed the list is empty.
>
>I'm not sure this is even the right way to go about this. The list is roughly 300 rows. I'd rather thought persisting the list, since it rarely changes between posts was the right way to go. But, for now, I've simply changed things so I always instantiate the list. It's fast, and it works. However, I can see the potential for wanting to actually persist the list instead of reloading the DataReader (especially for DataSet sources). So, does anyone have any tips or cluesticks for me? TIA.
Nancy,
Thinking you've already tried client side caching (afraid to ask this) might it be you forgot binding?
Cetin