I have an asp.net Dropdownlist with autopostback enabled. It is not populated dynamically, its values are fixed in the HTML code :
<asp:dropdownlist id="ddlReportView" runat="server" autopostback="True" onselectedindexchanged="ddlReportView_SelectedIndexChanged" enableviewstate="true">
<asp:listitem text="Snapshot" value="SNAPSHOT"></asp:listitem>
<asp:listitem text="Detailled" value="DETAILLED"></asp:listitem>
<asp:listitem text="Review" value="REVIEW"></asp:listitem>
<asp:listitem text="Review Summary" value="REVIEW_SUMMARY"></asp:listitem>
</asp:dropdownlist>
If I select an item, it reloads the page to display a list with a different format. My problem is that when I click the back browser button, the dropdownlist’s value is still the last value selected.
Example:
At first the list is in Snaphshot mode:
alt text http://img44.imageshack.us/img44/3749/37948756.png
User then clicks on Review Summary mode:
alt text http://img36.imageshack.us/img36/545/96184426.png
The page now displays the review summary grid, all is OK:
alt text http://img17.imageshack.us/img17/8239/13194229.png
User presses the back button, grid is displayed in snapshot mode (which is OK), BUT the
dropdown still shows “Review Summary”!
alt text http://img190.imageshack.us/img190/6747/22053199.png
I tried setting the value of the select using javascript, but it does not work. Has anybody had that problem, or knows how to fix that?
Thanks.
I managed to get the javascript working on this one using jQuery…
or if the initial value should be the ‘SNAPSHOT’ option…