2个页面间不通过Session与url的传值方式。
来源:互联网 发布:jvm java heap space 编辑:程序博客网 时间:2024/06/15 09:08
下面是全部代码,已经编译通过。
Chuandi(传递)是名字空间
WebForm1:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" Inherits="chuandi.WebForm1" %>
<HTML>
<HEAD>
<title>WebForm1</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="传"></asp:Button>
</form>
</body>
</HTML>
using System;
namespace chuandi
{
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
public string Text1
{
get
{
return this.TextBox1.Text;
}
}
private void Page_Load(object sender, System.EventArgs e)
{}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
private void Button1_Click(object sender, System.EventArgs e)
{
Server.Transfer("WebForm2.aspx");
}
}
}
WebForm2:
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" Inherits="chuandi.WebForm2" %>
<%@ Reference Page="WebForm1.aspx" %>
<HTML>
<HEAD>
<title>WebForm2</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server">Label</asp:Label>
<asp:Button id="Button1" runat="server" Text="返回"></asp:Button>
</form>
</body>
</HTML>
using System;
namespace chuandi
{
public class WebForm2 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label1;
public chuandi.WebForm1 wf1;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
wf1=(chuandi.WebForm1)Context.Handler;
Label1.Text="上页传来的是:"+wf1.Text1;
}
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
private void Button1_Click(object sender, System.EventArgs e)
{
Server.Transfer("WebForm1.aspx");
}
}
- 2个页面间不通过Session与url的传值方式。
- 2个页面间不通过Session与url的传值方式
- Spring MVC中redirect到一个页面,同时带些信息过去进行显示,但是不通过Session方式及URL方式
- 页面之间的url传值获取方式
- 不通过action,实现页面之间传值
- 如何在JSP页面上直接获取url的参数呢(不通过controller设置)?
- struts2页面取值方式及url,if的用法
- 关于页面跳转同时传参,存于session或拼接与URL中?安全问题?
- 不通过第三个变量来交换两个变量的值
- js页面传值乱码以及url获取方式
- Jsp页面获得url参数的方式
- 在一个jsp页面接收另一个jsp页面通过URL方式传过来的参数
- iOS 页面间的传值方式
- session页面传值
- cookies禁用后使用url重写的方式使用session
- jsp页面中的session、cookies、隐藏域、url重写四种会话及跟踪方式
- jsp页面中的session、cookies、隐藏域、url重写四种会话及跟踪方式
- jsp页面中的session、cookies、隐藏域、url重写四种会话及跟踪方式
- vss版本控制
- 最新电脑网络技术学习资料汇总
- 绝对常用精华网址(吐血奉献)[分享]
- 请问“回”字有几种写法?
- 解读ASP.NET Portal Starter Kit(3)——代码文件篇
- 2个页面间不通过Session与url的传值方式。
- PHP 链接ACCESS 数据库最简单的方法
- It's not over yet!
- Life Summary
- [收藏]企 业 里 的 成 功 物 语
- 《Boland传奇》
- 走出你职业生涯的瓶颈[zt]
- 庆祝升任软件项目管理群管理员
- promises don't come easy