All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
visual c++类中的多重继承
通过缓存数据库结果提高PHP性能_php资料_编程技术
delphi结构化异常处理
在GridView中显示图片_[Asp.Net教程]
ASP.NET技巧:使用,Anthem.NET,框架的一个调试经历_[Asp.Net教程]
解决SQL Server常见的七个经典问题_[SQL Server教程]
javascript函数,判断数字的合法性_JavaScript技术_编程技术
asp.net中Session对象的概念以及属性
c#,MD5加密算法的一个实例_[Asp.Net教程]
Asp.net,文件上传基类(取得文件后缀名,保存文件,加入文字水印)_[Asp.Net教程]
Reading number is top 10 pictures
9.3阅兵全景图6-常规导弹梯队和核导弹梯队
More attractive than sora aoi2
The household of rural style is designed
In 2013 hercules Arnold classic2
From China fortress sora aoi5
2012 national geographic daily picture8
NeedWallpaper14
王艳写真温柔如水1
The little girl with long hair2
From China fortress sora aoi1
Download software ranking
打鸟视频
C++教程第四版
Unix video tutorial11
VC++6.0简体中文版
Dance with duck(male prostitution)
仙剑奇侠传98硬盘WINXP版
Boxer's Top ten classic battle5
艳兽都市
I'm come from Beijing1
在线棋牌游戏3.05版
归海一刀 published in(发表于) 2014/1/30 1:16:35 Edit(编辑)
5种ASP.NET页面间传递参数实例代码_[Asp.Net教程]

5种ASP.NET页面间传递参数实例代码_[Asp.Net教程]

5种ASP.NET页面间传递参数实例代码_[Asp.Net教程]
本文假设第一个页面为send.aspx,第二个页面为receive.aspx
1、通过URL链接地址传递
(1) send.asp代码

protected void Button1_Click(object sender, EventArgs e)
{
Request.Redirect("Default2.aspx?username=honge");
}

(2) receive.aspx代码

string username = Request.QueryString["username"];//这样可以得到参数值。

2、POST方式传递
(1) send.asp代码










(2) receive.aspx代码

string username = Ruquest.Form["receive"];

3、Session方式传递
(1) send.asp代码

protected void Button1_Click(object sender, EventArgs e)
{
Session["username"] = "honge";
Request.Redirect("Default2.aspx");
}

(2) receive.aspx代码

string username = Session["username"];//这样可以得到参数值。

4、Application方式传递
(1) send.asp代码

protected void Button1_Click(object sender, EventArgs e)
{
Application["username"] = "honge";
Request.Redirect("Default2.aspx");
}

(2) receive.aspx代码

string username = Application["username"];这样可以得到参数值。

5、使用Server.Transfer进行传递
(1) send.asp代码

public string Name
{
get {
return "honge";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Server.Transfer("Default2.aspx");
}

(2) receive.aspx代码

send d = Context.Handler as send ;
if (d != null)
{
Response.Write(d.Name);//这样可以得到参数值。
}


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.