一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

2個頁面間不通過Session與url的傳值方式

下面是全部代碼,已經編譯通過。
Chuandi(傳遞)是名字空間

WebForm1:
<%@ Page language="c#" Codebehind="WebForm1.ASPx.cs" Inherits="chuandi.WebForm1" %>
<HTML>
 <HEAD>
  <title>WebForm1</title>
 </HEAD>
 <body>
  <form id="Form1" method="post" runat="server">
   <ASP:TextBox id="TextBox1" runat="server"></ASP:TextBox>
   <ASP:Button id="Button1" runat="server" Text="傳"></ASP:Button>
  </form>
 </body>
</HTML>
using System;
namespace chuandi
{
 public class WebForm1 : System.Web.UI.Page
 {
  protected System.Web.UI.WebControls.TextBox TextBox1;
  protected System.Web.UI.WebControls.Button Button1;
  public string Text1
  {
   get
   {
    return this.TextBox1.Text;
   }
  }
  private void Page_Load(object sender, System.EventArgs e)
  {}
  override protected void OnInit(EventArgs e)
  {
   InitializeComponent();
   base.OnInit(e);
  }
  private void InitializeComponent()
  {   
   this.Button1.Click += new System.EventHandler(this.Button1_Click);
   this.Load += new System.EventHandler(this.Page_Load);
  }
  private void Button1_Click(object sender, System.EventArgs e)
  {
   Server.Transfer("WebForm2.ASPx");
  }
 }
}


WebForm2:
<%@ Page language="c#" Codebehind="WebForm2.ASPx.cs" Inherits="chuandi.WebForm2" %>
<%@ Reference Page="WebForm1.ASPx" %>
<HTML>
 <HEAD>
  <title>WebForm2</title>
 </HEAD>
 <body>
  <form id="Form1" method="post" runat="server">
   <ASP:Label id="Label1" runat="server">Label</ASP:Label>
   <ASP:Button id="Button1" runat="server" Text="返回"></ASP:Button>
  </form>
 </body>
</HTML>
using System;
namespace chuandi
{
 public class WebForm2 : System.Web.UI.Page
 {
  protected System.Web.UI.WebControls.Button Button1;
  protected System.Web.UI.WebControls.Label Label1;
  public chuandi.WebForm1 wf1;
  private void Page_Load(object sender, System.EventArgs e)
  {
   if(!IsPostBack)
   {
    wf1=(chuandi.WebForm1)Context.Handler;
    Label1.Text="上頁傳來的是:"+wf1.Text1;
   }
  }
  override protected void OnInit(EventArgs e)
  {
   InitializeComponent();
   base.OnInit(e);
  }
  private void InitializeComponent()
  {   
   this.Button1.Click += new System.EventHandler(this.Button1_Click);
   this.Load += new System.EventHandler(this.Page_Load);
  }
  private void Button1_Click(object sender, System.EventArgs e)
  {
   Server.Transfer("WebForm1.ASPx");
  }
 }

AspNet技術2個頁面間不通過Session與url的傳值方式,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲免费一区二区 | 国语自产拍在线观看任你躁 | 精品久久久久国产 | 国产91视频观看 | 成人精品人成网站 | 婷婷国产成人久久精品激情 | 九九精品视频在线观看 | 亚洲综合激情 | 国产v综合v亚洲欧美大片 | 国产永久视频 | 国产在线永久视频 | 狠狠色影院 | 成人综合激情 | 久久手机视频 | 女人被爽到呻吟娇喘的视频动态图 | 国产精品嫩草影院免费看 | 免费精品美女久久久久久久久久 | 毛片美女| 国产成人精品亚洲午夜麻豆 | 99久久国产综合精品swag超清 | 国产高清一区二区三区四区 | 在线黄色观看 | 91天天干| 色偷偷7777www人 | 激情婷婷| 555夜色666夜色精品站 | 视频区 图片区 小说区 | 国产精品免费大片一区二区 | 国产原创中文字幕 | 99在线观看国产 | 伊人热热久久原色播放www | 国产视频二 | 无码精品一区二区三区免费视频 | 国产色影院 | 精品伊人久久久大香线蕉欧美 | 国产永久在线观看 | 久久久精彩视频 | 东北普通话清晰对白 | 国产极品白嫩美女在线观看看 | 久久伊人久久亚洲综合 | 皮皮在线精品亚洲 |