At ASP.NET 1.x, many friends may need to process across page submission, that is, from page A to page B, or even different Control's target processing page is different. Especially developers from ASP / JSP / PHP, may have this need. But unfortunately, when ASP.NET 1.x, it is very ugly that there is a lot of "skills" processing.
At ASP.NET 2.0, there is a very reasonable solution for cross-page submission, the following is an example.
SourcePage.aspx: Please note button of Button1 PostbackURL property settings
<%
...
@ Page language = "c #"
%>
DOCTYPE HTML PUBLIC "- // w3c // DTD XHTML 1.0 Transitional // En" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"
>
<
Script
Runat
= "Server"
>
...
Public String YourName
... {
get
... {
Return this.TextBox1.text;
}
}
Script
>
<
HTML
XMLNS
= "http://www.w3.org/1999/xhtml"
>
<
HEAD
Runat
= "Server"
>
<
Title
>
UnTID PAGE
Title
>
HEAD
>
<
Body
>
<
FORM
id
= "Form1"
Runat
= "Server"
>
<
Div
>
<
ASP: Label
Id
= "Label1"
Runat
= "Server"
TEXT
= "Please enter your name"
Width
= "183px"
>
ASP: Label
>
<
ASP: TEXTBOX
Id
= "TextBox1"
Runat
= "Server"
>
ASP: TEXTBOX
>
<
ASP: Button
Id
= "Button1"
Runat
= "Server"
TEXT
= "Submit"
Postbackurl
= "~ / Targetpage.aspx"
/>
Div
>
FORM
>
Body
>
HTML
>
TargetPage.aspx: Please note the properties settings of PreviOUSPAGETYPE
<%
...
@ Page language = "c #"
%>
<%
...
@ PreviousPageType VirtualPath = "~ / SourcePage.ASPX"
%>
DOCTYPE HTML PUBLIC "- // w3c // DTD XHTML 1.0 Transitional // En" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<
Script
Runat
= "Server"
>
...
Protected void Page_load (Object Sender, Eventargs E)
... {
THIS.Label1.Text = previouspage.Yourname;
}
Script
>
<
HTML
XMLNS
= "http://www.w3.org/1999/xhtml"
>
<
HEAD
Runat
= "Server"
>
<
Title
>
UnTID PAGE
Title
>
HEAD
>
<
Body
>
<
FORM
id
= "Form1"
Runat
= "Server"
>
<
Div
>
<
ASP: Label
Id
= "Label1"
Runat
= "Server"
>
ASP: Label
>
Div
>
FORM
>
Body
>
HTML
>
OK, you can easily get a transplition of the characteristics through such a simple two attribute settings. Of course, you can also make more complex settings, depending on your own needs, such as each Control needs to be submitted to a different page.