简体   繁体   English

返回上一页ASP.NET

[英]Go back to to previous page ASP.NET

Im having an issue of going back to the previous page. 我有回到上一页的问题。 The page i want to go back to had a few radio buttons which you had to select, after this you went to the next page which is the current page which then you can select certain things BUT I want to be able to go back to the previous page and the original selections for that page still be selected. 我要返回的页面有几个单选按钮,您必须选择这些按钮,然后转到下一页,即当前页面,然后您可以选择某些我想返回的内容。上一页以及该页面的原始选择仍处于选中状态。

Anyway i could do this if so how????? 无论如何,如果可以的话,我可以这样做?

You can do a real basic back button with the help of JavaScript. 您可以借助JavaScript进行真正的基本后退按钮。

window.history.go(-1);

which will take you back to the previous page. 这将带您返回上一页。

By default in ASP.NET state of controls is stored in ViewState, so it should be the same as user left them. 默认情况下,ASP.NET中控件的状态存储在ViewState中,因此它应与用户离开它们时相同。

It is probably some view-state issue. 这可能是一些视图状态问题。

Go to your codebehind and check PageLoad method. 转到代码隐藏处,然后检查PageLoad方法。 If you are creating or setting radios in PageLoad, you do not want to re-init them every post-back. 如果要在PageLoad中创建或设置无线电,则不想在每次回发后都重新初始化它们。

if (!IsPostBack){
 // your init here
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM