The following is all the code that has been compiled.
Chuandi (PASS) is the namespace
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. button#click );
This. Load + = new System. EventHandler (this. Page_Load );
}
Private void button#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 = "back"> </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 = "the above page is:" + wf1.Text1;
}
}
Override protected void OnInit (EventArgs e)
{
InitializeComponent ();
Base. OnInit (e );
}
Private void InitializeComponent ()
{
This. Button1.Click + = new System. EventHandler (this. button#click );
This. Load + = new System. EventHandler (this. Page_Load );
}
Private void button#click (object sender, System. EventArgs e)
{
Server. Transfer ("WebForm1.aspx ");
}
}