c#asp.net中像Chrome浏览器后退按钮的上一个按钮的代码 [英] code for previous button like chrome browser back button in c# asp.net
本文介绍了c#asp.net中像Chrome浏览器后退按钮的上一个按钮的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
即时工作在线测试项目并在问题页面上设置上一个按钮我想编码上一个按钮编码就像Chrome浏览器后退按钮意味着如果用户选择一个单选按钮并转到下一页但突然点击上一页所有选中的节目就像他/她做的那样。
i m working on online test project and set a previous button on question page i wanted to code previous button coding as like chrome browser back button means if user select a radio button and go to the next page but suddenly click the previous page all the checked show as it is as he/she has done .
推荐答案
你可以通过按钮点击导航到任何方向,比如prev和这样的嵌套为前一个
YOU can navigate by button click to any direction like prev and nest like this for previous
<input action="action" type="button" value="Back" önclick="history.go(-1);" />
<head runat="server">
<title></title>
<script type="text/javascript">
function Navigate() {
alert('hi');
history.go(-1);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input action="action" type="button" value="Back" önclick="Navigate();" />
</form>
</body>
</html>
>
试试这个:
页面加载:
Try this:
In page load:
previousPage = Request.UrlReferrer.ToString();
在previuos页面按钮点击事件:
In previuos page button click event:
Response.Redirect(previousPage);
我总共有四页,我已删除你的代码,以便你可以按照你的意愿使用
Default.aspx.cs
i have total have four page, i have removed your code so that you can use it as your wish
Default.aspx.cs
public partial class _Default : System.Web.UI.Page
{
int result = 0;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (RadioButton1.Checked)
{
result += 5;
}
else if ((RadioButton2.Checked) || (RadioButton3.Checked))
{
result -= 2;
}
Response.Redirect("Default2.aspx?result=" + result);
}
}
Default2.aspx.cs
public partial class Default2 : System.Web.UI.Page
{
int result = 0;
protected void Page_Load(object sender, EventArgs e)
{
result =int.Parse(Request.QueryString["result"]);
}
protected void Button1_Click(object sender, EventArgs e)
{
if (RadioButton2.Checked)
{
result += 5;
}
else if ((RadioButton1.Checked) || (RadioButton3.Checked))
{
result -= 2;
}
Response.Redirect("Default3.aspx?result=" + result);
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx?result=" + result);
}
}
Default3.aspx.cs
public partial class Default3 : System.Web.UI.Page
{
int result = 0;
protected void Page_Load(object sender, EventArgs e)
{
result = int.Parse(Request.QueryString["result"]);
}
protected void Button1_Click(object sender, EventArgs e)
{
if (RadioButton3.Checked)
{
result += 5;
}
else if ((RadioButton1.Checked) || (RadioButton2.Checked))
{
result -= 2;
}
Response.Redirect("Default4.aspx?result=" + result);
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("Default2.aspx?result=" + result);
}
}
Default4.aspx.cs
public partial class Default4 : System.Web.UI.Page
{
int result = 0;
protected void Page_Load(object sender, EventArgs e)
{
result =int.Parse(Request.QueryString["result"]);
Label2.Text = result.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Default2.aspx?result=" + result);
}
}
its very urgent for me
这篇关于c#asp.net中像Chrome浏览器后退按钮的上一个按钮的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文