I am loading Dropdownlist items from an xml file. Items get loaded. The load code is under Page load event. The problem is every time page postbacks, i lose the items ... not sure how I can retain in the DDL.
I check querystring value and select the listitem (selectedvalue=qs). If querystring is missing I select the default first item. If querystring is incorrect (not existing in list of DDL values) I use the default value. I have been struggling with this code for long time now...
Here's my code- if (!Page.IsPostBack)
DropDownListTemplates.SelectedValue = Request.QueryString["t"].ToString();
DropDownListTemplates.SelectedIndex = -1;
Is there a better way to load XML data in to dropdownlist other then looping selected records?
View Complete Post