首页 > 编程 > .NET > 正文

asp.net里怎么提交数据到另外一页去

2024-07-10 12:56:50
字体:
来源:转载
供稿:网友


可以使用的方法很多,例如象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>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表