四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

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

下面是全部代碼,已經(jīng)編譯通過。
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技術(shù)2個頁面間不通過Session與url的傳值方式,轉(zhuǎn)載需保留來源!

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

主站蜘蛛池模板: 快乐学习报| va视频在线| 铠甲勇士雷霆雅塔莱斯| 忍石| 69视频污| 口加一笔变新字有几个| 陈芷琰的搞笑日常| 张晓海个人资料| 日本电影继父| 地铁女孩| 烽火流金电视剧| 最新电影免费观看| 整容前后| 买买提个人资料简历| 托比·斯蒂芬斯| 扭曲的欲望| 李保田最经典十部电影| 艳女tv在线播放| 刑事侦缉档案1演员表| 暗夜尖叫1988美国版高清观看| meguri| 橘子洲旅游攻略| 卢靖姗老公是谁| 小矮人在线观看完整版| 杀破狼·贪狼 2017 古天乐| 年十二的图片| 老板娘2无间潜行| 谍变1939全部演员表| 女脱衣服| 蔡雅同| 食戟之灵第二季| 爱神的诱惑电影| douyin| 北京卫视今日电视剧| 朱丽安·摩尔| 诱惑的艺术| 樊城电影| 韩国电影《爱欲》| 等着我主持人| 泰国av| 性欧美18一69性sexhd|