asp.net获取页面url参数值的实现代码实例
2011-04-29 16:51
926 查看
asp.net获取页面url参数值的实现代码实例
file: default.aspx.cs
using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
public partial class querystringsender : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
}
protected void cmd_click(object sender, eventargs e)
{
response.redirect("nextpage.aspx" + "?version=" +
((control)sender).id);
}
}
file: nextpage.aspx
<%@ page language="c#"
autoeventwireup="true"
codefile="nextpage.aspx.cs"
inherits="querystringrecipient" %>
<!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>untitled page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:label id="lbldate"
runat="server"
width="528px"
height="112px"
font-names="verdana"
font-size="large"
enableviewstate="false">
</asp:label>
</div>
</form>
</body>
</html>
file: nextpage.aspx.cs
using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
public partial class querystringrecipient : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
lbldate.text = "the time is now:<br>" + datetime.now.tostring();
switch (request.querystring["version"])
{
case "cmdlarge":
lbldate.font.size = fontunit.xlarge;
break;
case "cmdnormal":
lbldate.font.size = fontunit.large;
break;
case "cmdsmall":
lbldate.font.size = fontunit.small;
break;
}
}
}
file: default.aspx
<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="querystringsender" %>
<!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>untitledwww.3ppt.com page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:button id="cmdlarge"
runat="server"
text="large text version"
onclick="cmd_click">
</asp:button>
<asp:button id="cmdnormal" runat="server" text="normal version" onclick="cmd_click"></asp:button>
<asp:button id="cmdsmall" runat="server" text="small text version" onclick="cmd_click"></asp:button>
</div>
</form>
</body>
</html>
file: default.aspx.cs
using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
public partial class querystringsender : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
}
protected void cmd_click(object sender, eventargs e)
{
response.redirect("nextpage.aspx" + "?version=" +
((control)sender).id);
}
}
file: nextpage.aspx
<%@ page language="c#"
autoeventwireup="true"
codefile="nextpage.aspx.cs"
inherits="querystringrecipient" %>
<!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>untitled page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:label id="lbldate"
runat="server"
width="528px"
height="112px"
font-names="verdana"
font-size="large"
enableviewstate="false">
</asp:label>
</div>
</form>
</body>
</html>
file: nextpage.aspx.cs
using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;
public partial class querystringrecipient : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
lbldate.text = "the time is now:<br>" + datetime.now.tostring();
switch (request.querystring["version"])
{
case "cmdlarge":
lbldate.font.size = fontunit.xlarge;
break;
case "cmdnormal":
lbldate.font.size = fontunit.large;
break;
case "cmdsmall":
lbldate.font.size = fontunit.small;
break;
}
}
}
file: default.aspx
<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="querystringsender" %>
<!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>untitledwww.3ppt.com page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:button id="cmdlarge"
runat="server"
text="large text version"
onclick="cmd_click">
</asp:button>
<asp:button id="cmdnormal" runat="server" text="normal version" onclick="cmd_click"></asp:button>
<asp:button id="cmdsmall" runat="server" text="small text version" onclick="cmd_click"></asp:button>
</div>
</form>
</body>
</html>
相关文章推荐
- ASP.NET获取MS SQL Server安装实例实现思路及代码
- ASP.NET获取MS SQL Server安装实例实现思路及代码
- asp.net获取当前网址url的各种属性(文件名、参数、域名 等)的代码
- ASP.NET中防止页面多次提交的代码实现
- ASP.NET中防止页面多次提交的代码实现
- asp.net获取当前页面的url地址
- 简单的asp.net模拟邮箱系统基础实现(二 (1)具体版块功能的实现及关键代码之注册页面)
- 利用Mircosoft URLRewriter.dll实现asp.net页面伪静态
- asp.net获取当前网址url的各种属性(文件名、参数、域名 等)的代码
- Js获取asp页面返回的值(加载值)实现代码
- ASP.NET打开新页面而不关闭原来的页面 实例代码
- Asp.net中配置Web.config 的UrlRewrite实现伪静态页面的代码
- 利用Mircosoft URLRewriter.dll实现asp.net页面伪静态
- ASP.NET中防止页面多次提交的代码实现
- asp.net 页面回跳实现代码
- 【转】asp.net获取当前页面的url地址
- ASP.NET中防止页面多次提交的代码实现
- 用asp.net实现远程获取其他网站页面指定内容
- ASP.NET中防止页面多次提交的代码实现