当我单击第二页时如何编写代码 [英] how to write the code when i am click the second page
本文介绍了当我单击第二页时如何编写代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有三个链接:
第一个链接是第1页,包含表单
第二个链接是第2页,包含表单
第3个链接是第3页,包含表单
我将值输入第一个表格,然后单击第二个链接,然后从
转到第一个
第一种形式的值不见了.我需要单击时转到第一种形式.如何在csharp
i have three links:
1st link is page 1 has contain form
2nd link is page 2 has contain form
3rd link is page 3 has contain form
i enter the values into the first form then clik the 2nd link next go to the first from then
1st form values gone. i need when i am click go to 1st form not gone. how to write code in csharp
推荐答案
中阅读代码以阅读下面的文章以进行重定向,并在不关闭上一个页面的情况下打开新页面
http://www.techrepublic.com/blog/在aspnet/743中进行编程和开发/双向处理 [
read below article for redirect and open new page without closing previous one
http://www.techrepublic.com/blog/programming-and-development/two-approaches-to-redirection-in-aspnet/743[^]
查看此链接,您可能会有所了解
http://msdn.microsoft.com/en-us/magazine/cc300437.aspx [ ^ ]
或
使用会话管理概念
看到这些链接,您可能会有所了解
ASP.NET中的会话管理选项 [ http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx [ ^ ]
see this link you may get some idea
http://msdn.microsoft.com/en-us/magazine/cc300437.aspx[^]
or
use session management concepts
see these links you may get some idea
Session management options in ASP.NET[^]
http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx[^]
U可以通过会话传递值.
Page1.cs:
U can pass the value through session.
Page1.cs:
protected void Button1_Click(object sender, EventArgs e)
{
HttpCookie cName = new HttpCookie("Name");
cName.Value = TextBox1.Text;
Response.Cookies.Add(cName);
Response.Redirect("Page2.aspx");
Form.Dispose();
}
Page2.cs:
Page2.cs:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("linform1.aspx");
Constr=System.Configuration.ConfigurationManager.ConnectionStrings["masterConnectionString1"].ToString ();
}
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["Name"] != null)
TextBox1.Text = Request.Cookies["Name"].Value;
}
您可以尝试这样.它将为您提供帮助
U can try like this.It will help you
这篇关于当我单击第二页时如何编写代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文