darylbewise
Programmer
I am looking to save the value of a dropdown box which is located on a masterpage when I flip between other pages that use the masterpage.
For example, all my masterpage contains is a dropdown box with a few items:
When a user visits page1.aspx, the following code will be executed:
Then the user will visit page2.aspx. When this page is loaded, the dropdown box value on the masterpage is set back to the default and does not remain at "2".
Is there any way of getting the dropdown box to remember its value (without the use of Sessions)?
For example, all my masterpage contains is a dropdown box with a few items:
Code:
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="" Value=""></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
</asp:DropDownList>
When a user visits page1.aspx, the following code will be executed:
Code:
protected void Page_Load(object sender, EventArgs e)
{
DropDownList test = (DropDownList)((MasterPage)Master).FindControl("DropDownList1");
test.SelectedValue = "2";
}
Then the user will visit page2.aspx. When this page is loaded, the dropdown box value on the masterpage is set back to the default and does not remain at "2".
Is there any way of getting the dropdown box to remember its value (without the use of Sessions)?