标签:style blog http io color ar os 使用 sp
1 page1.aspx 2 protected void Button1_Click(object sender, EventArgs e) 3 { 4 Response.Redirect("page2.aspx?name=" + TextBox1.Text); 5 } 6 page2.aspx 7 if (Request.QueryString["name"] != null) 8 { 9 TextBox1.Text = Request.QueryString["name"]; 10 }
1 protected void Button1_Click(object sender, EventArgs e) 2 { 3 //Cookies由服务器端创建,但保存在客户端 4 HttpCookie cName = new HttpCookie("Name"); 5 cName.Value = TextBox1.Text; 6 Response.Cookies.Add(cName); 7 Response.Redirect("page2.aspx"); 8 } 9 10 protected void Page_Load(object sender, EventArgs e) 11 { 12 if (Request.Cookies["Name"] != null) 13 { 14 TextBox1.Text = Request.Cookies["Name"].Value; 15 } 16 }
1 protected void Button1_Click(object sender, EventArgs e) 2 { 3 Session["ses"] = TextBox1.Text; 4 Response.Redirect("page2.aspx"); 5 } 6 protected void Page_Load(object sender, EventArgs e) 7 { 8 if(Session["ses"]!=null) 9 { 10 TextBox1.Text = Session["ses"].ToString(); 11 } 12 }
1 protected void Button1_Click(object sender, EventArgs e) 2 { 3 Application["app"] = TextBox1.Text; 4 Response.Redirect("page2.aspx"); 5 } 6 protected void Page_Load(object sender, EventArgs e) 7 { 8 if (Application["app"] != null) 9 { 10 TextBox1.Text = Application["app"].ToString(); 11 } 12 }
1 public string Name { get { return this.TextBox1.Text.Trim().ToString(); } } 2 protected void Button1_Click(object sender, EventArgs e) 3 { 4 Server.Transfer("page2.aspx"); 5 } 6 7 --在page2.aspx页面引入:<%@ Reference Page="~/page1.aspx" %> 8 protected void Page_Load(object sender, EventArgs e) 9 { 10 page1 p = (page1)Context.Handler; 11 //TextBox1.Text = p.Name;这样也可以 12 TextBox1.Text = ((TextBox)p.FindControl("TextBox1")).Text; 13 }
标签:style blog http io color ar os 使用 sp
原文地址:http://www.cnblogs.com/hexd1230/p/4087748.html