一区二区久久-一区二区三区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的傳值方式,轉載需保留來源!

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

主站蜘蛛池模板: 色加勒比| 亚洲精品午夜级久久久久 | 成年人激情网站 | 国产自愉自愉全免费高清 | 天天干天天干天天干 | 日本一区二区在线播放 | 护士精品一区二区三区 | a色在线 | 亚洲国产精品综合久久一线 | 中文字幕国产一区 | 一级特黄国产高清毛片97看片 | 四虎永久在线免费观看 | 国产一级特黄全黄毛片 | 另类国产精品一区二区 | 秋霞影音先锋一区二区 | 日日噜噜噜夜夜爽爽狠狠视频 | 青青草国产精品人人爱99 | 播放久久国产乱子伦精品 | 一区二区三区国产 | 樱花aⅴ一区二区三区四区 影音先锋 色天使 | 久久久夜间小视频 | 亚洲区色 | 亚州欧美 | 爱综合网 | 国产亚洲漂亮白嫩美女在线 | 美女视频黄的全免费视频网站 | 日日草草 | 深夜福利小视频 | 好吊妞视频免费观看va | 自愉自愉自产国产91 | se色综合视频 | 中文字幕日韩精品一区口 | 国产精品自在自线 | 激情网站免费 | 麻豆高清| aa级国产女人毛片水真多 | 精品免费福利视频 | 日本青草| 国产精品久久精品福利网站 | 韩国理论福利片午夜 | 91精品福利手机国产在线 |