首页 收藏本站 设为首页
你的位置:首页网站开发asp.net 〉介绍ASP.NET实现页面间值传递的方法(一)
介绍ASP.NET实现页面间值传递的方法(一)

发布时间:2008-3-18       字体[  ]

第一种方法:

通过URL链接地址传递

以下为引用的内容:
 send.aspx:
  protected void Button1_Click(object sender, EventArgs e)
    {
        Request.Redirect("Default2.aspx?username=honge");
    }
 receive.aspx:
 string username = Request.QueryString["username"];

 

这样可以得到参数值。
 
第二种方法:

通过post方式。

以下为引用的内容:

send.aspx

Chinaz.com

<form id="form1" runat="server" action="receive.aspx" method=post>
    <div>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:TextBox ID="username" runat="server"></asp:TextBox>
</div>
    </form>
receive.aspx
string username = Ruquest.Form["receive"];

 

 

第三种方法:

通过session

以下为引用的内容:
send.aspx:
  protected void Button1_Click(object sender, EventArgs e)
    {
        Session["username"] = "honge";
        Request.Redirect("Default2.aspx");
    }
 receive.aspx:
 string username = Session["username"];

 

这样可以得到参数值。

 

相关文章
介绍ASP.NET实现页面间值传递的方法(二)
介绍ASP.NET实现页面间值传递的方法(一)
介绍Asp.Net中的Response对象的方法
asp.net设计中的性能优化问题分析
[  打印本页 ] [  来源:网络 ]     [    ]
站内搜索
最新文章
热点文章
友情链接广告服务联系我们网站地图意见反馈
Copyright @2007 qiixun.com All rights reserved.