Last post Jul 14, 2019 06:43 PM by KathyW
Jul 12, 2019 11:02 AM|jsshivalik|LINK
i have below code . When it redirects to Form2.aspx and when i click browser back option div1 is in visible mode . It should be false.
If i don't redirect to form2 page ( i comment response.redirect) then div1 is not visible it works fine.
protected void ddl_Option_SelectedIndexChanged(object sender, EventArgs e)
if (ddl_Option.SelectedValue == "1")
Jul 12, 2019 12:17 PM|AddWeb Solution|LINK
as per your question not cleared how this happen because we can't see your all code here.
But as per understanding you need to set :
In page load event which you go back after press browser back button. hope this one missing from your side.
Jul 12, 2019 12:19 PM|PatriceSc|LINK
Response.Redirect stops sending back content for the current page and
instead ask the browser to go to another page.
The user shouldn't be able to change his mind at all ??? (even if starting new on the previous page ???)
Jul 13, 2019 01:38 PM|jsshivalik|LINK
Since i have div1.visible = false before redirect div1 should have visible false , but when i click on back button of browser from form1.aspx div1 is still visible.
That's my point. When i comment redirect then div1 is not showing up & that is correct.
Jul 14, 2019 06:43 PM|KathyW|LINK
"Since i have div1.visible = false before redirect div1 should have visible false ,"
No, you are setting div1.visible = false on the server, in code behind, then you do a redirect to a different page. That visible=false never gets sent down to the browser, only the different page does. (It works if you comment out the redirect because you
are still on the same page and the change is sent down to the browser.) So a back button doesn't have a cached version of the page with the div not visible, only visible, and if you have nocache set, the page runs again, and the div is visible as it would
be when the page is first loaded.
You need a new approach.