Author: nimish | Posted on: 9/14/2010 12:20:17 PM | Views : 781

Hello All-
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) { LoadDropDownList(); try { DropDownListTemplates.SelectedValue = Request.QueryString["t"].ToString(); } catch (Exception) { DropDownListTemplates.SelectedIndex = -1; } }
Is ...

Go to the complete details ...