0
votes

I have two pages, Page1 and Page2. On page1, I have a checkbox below it an update panel and few controls in update panel such as radio button and combo boxex. This is my client side.

<asp:checkbox><asp:checkbox>
</br>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
             <ContentTemplate>
                <div id="div1" runat="server">
                <asp:Panel ID="pnl1" runat="server" 
</div>
</Panel>
 </ContentTemplate>
</UpdatePanel>

</br>
<asp:Button></Button>

When user checks the checkbox(which is outside the update panel), the pnl1 gets visble and when unchecked, pnl1 gets invisible. The checkbox is checked. Now When I click a button which is on page1, it redirects to page2. Now I am on page2 and I hit back button to go on page1. When I go on page1, I want to see the checkbox checked. I am using Mozilla. Could anybody tell me please,how can I achieve this.

your input is much appreciated. Thank you.

1
You could use a Session value to set the check box. Which you would need to set or unset when the checkbox is clicked which could be done using AJAX or some other form, Another way would just be to append it to the url query however this may not, probably not, be the best way. - Nomad101
Thank you for your reply. To make my question very specific, I don't want to refresh or reload or change the state/value of controls to its default state on page 1, when user hits the back button. - Jay Gade
Ahhhh I see you could be referring to something like this question stackoverflow.com/questions/9788688/… - Nomad101
Thanks. I think, this is kind of sliding or animation feature. In my case, I am using response.redirect to navigate to another page. For example, if my checkbox is checked and I redirect it to page2 and come back to page1 using back button, my checkbox is unchecked. where as I want it to be checked. - Jay Gade

1 Answers

0
votes

If you redirect to page then first is called Page_load function. I am sure, you have something with checking Checkboxes in this function. (Also if you will have button on this page and will click to it, it will call this function again). You can use some boolean variable (which is crappy solution) or Session.

For example, something like that:

protected void Page_Load(object sender, EventArgs e)
    {
        if(Session["abc"] == null) {
            ...
            ...
            Session["abc"] = "something";
        }

    }