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

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

主站蜘蛛池模板: 欧洲精品在线视频 | 亚洲夂夂婷婷色拍ww47 | 99999久久久久久亚洲 | 影音先锋 色天使 | 一级做a爰片性色毛片2021 | 美女视频黄是免费 | 亚洲国产精品久久久久网站 | 亚洲一区二区三区精品影院 | 九九热免费在线观看 | 国产精品一区在线免费观看 | 三区在线视频 | 国产成人免费高清视频网址 | 国产一在线 | 夜色亚洲| 亚洲精品在线影院 | 亚洲欧洲国产经精品香蕉网 | 久久香蕉精品 | 婷婷综合久久狠狠色99h | 久久久久综合网久久 | 成人免费一区二区三区 | 视频一区二区三区在线 | 五月玖玖 | 自偷自拍亚洲欧美清纯唯美 | 精品国产高清a毛片无毒不卡 | 久久大香香蕉国产免费网站 | 国产成人精品在线 | 狠狠色伊人亚洲综合第8页 狠狠色伊人亚洲综合网站l | 亚洲香蕉久久一区二区三区四区 | 欧美三级黄色 | 天天做天天爱夜夜大爽完整 | 深爱婷婷 | 国产免费一区二区三区最新 | 欧美人体极品大胆露私 | 在线激情网 | 色综合天天综合网国产成人网 | 大量国产激情视频在线观看 | 91欧美精品| 色偷偷亚洲第一成人综合网址 | 国产精品亚洲自在线播放页码 | 国产精品一区伦免视频播放 | 欧美日韩亚洲另类 |