易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET页面传值_第二篇_查询字符串

例一:
+++ 第一个页面
++ 页面代码如下:
<div>
 <a href="QueryString04.aspx?blog=DoooooNetooooot.blog.tianya.cn&qq=516535763">超链接传值示例</a>
</div>
++ 后台代码如下:
(略)
+++ 第二个页面
++ 页面代码如下:
(略)
++ 后台代码如下:
protected void Page_Load(object sender, EventArgs e)
{
  if (Request["blog"] != null || Request["qq"] != null)
  {
    Response.Write("BLOG地址:" + Request["blog"].ToString() +
        "</br>QQ号:" + Request["qq"].ToString());
  }
}
例二:
+++ 第一个页面:
++ 页面代码如下:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="BtnQueryString" /><br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
++ 后台代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
  string strUrl = @"QueryString02.aspx?name=" +
      TextBox1.Text.Trim().ToString() + "&email=" + TextBox2.Text.Trim().ToString();
  Response.Redirect(strUrl);
}
+++ 第二个页面
++ 页面代码如下:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
++ 后台代码如下:
protected void Page_Load(object sender, EventArgs e)
{
  if (Request.QueryString["name"] != null || Request.QueryString["email"] != null)
  {
    TextBox1.Text = Request.QueryString["name"].ToString();
    TextBox2.Text = Request.QueryString["email"].ToString();
  }
  //或
  //TextBox1.Text = Request["name"].ToString();
  //TextBox2.Text=Request["email"].ToString();
  //或
  //TextBox1.Text = Request.Params["name"].ToString();
  //TextBox2.Text = Request.Params["email"].ToString();
}
+++ 说明
(1) 用查询字符串方式可以把值传递给下一个页面;


相关文档:

在ASP.NET中使用FCKeditor的方法

之前用的在线编辑器是DotNetTextBox ,并且曾一度觉得它异常强大,如可以给上传的图片加文字水印或者图片水印,但后来发现其上传的图片不容易管理,都挤在一个文件夹里面(免费版,付费版好像可以分文件夹上传保存图片),并且段首空格总不是所见即所得,我编辑时空了两个字符的位置,到了前台页面的时候只有一个字符,所以 ......

ASP.NET 定时执行一段代码 Global.asax

在Global.asax启动一条线程就ok了,下面是启动线程定时写文件的例子
在Global.asax
C# code:
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading" %>
<script runat="server">   
 string LogPath;  ......

asp.net 页面打印问题

WebBrowser控件 打印2
WebBrowser是IE内置的浏览器控件,无需用户下载.
一、WebBrowser控件
  <object ID='WebBrowser' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>
二、WebBrowder控件的方法
//打印
WebBrowser1.ExecWB(6,1);
//打印设置
WebBrowser ......

asp.net 获取当前URL的正确方法

HttpContext.Current.Request.Url.ToString() 并不可靠。
如果当前URL为
http://localhost/search.aspx?user=http://csharp.xdowns.com&tag=%BC%BC%CA%F5
通过HttpContext.Current.Request.Url.ToString()获取到的却是
http://localhost/search.aspxuser=http://csharp.xdowns.com&tag=&frac14;&fra ......

学习ASP.NET中的Application、Session、Cookie

学习ASP.NET中的Application、Session、Cookie
1.Application建立的变量,在系统内部任何地方都可以访问,通常网站地访问统计可能会用的较多。如果要用到Application首先在VS2005中建立一个global.asa文件。例如我们要写一个网站访问数量的统计的话,在global.asa中先声明变量iCount。如下所示:
     ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号