可以使用的方法很多,例如象Cookies、Session、HTTP参数等都可以,现在讲一种:
HTTP参数方法:
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Button id="Button1" Text="Submit" runat="server"/>
<asp:TextBox ID="textbox1" runat="server"/>
</form>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
Button1.Click += new EventHandler(this.Button1_Click);
}
void Button1_Click(Object sender, EventArgs e)
{
Response.Redirect( "show.aspx?textbox1="+textbox1.Text );
}
</script>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
</head>
<body>
<form runat="server" id="form1">
<asp:label ID="lbl1" runat="server"></asp:label>
</form>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
lbl1.Text = Request.QueryString.Get( "textbox1" );
}
</script>
</body>
</html>
本文地址:http://com.8s8s.com/it/it42228.htm