Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you try this </p> <p>this is first page</p> <pre><code>&lt;%@ Page Language="C#" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script runat="server"&gt; protected void Button1_Click(object sender, System.EventArgs e) { Label1.Text = "Your city name: " + TextBox1.Text.ToString(); } &lt;/script&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;PostBackUrl Example: how to submit a page to another page in asp.net&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="DarkSlateBlue"&gt;&lt;/asp:Label&gt; &lt;br /&gt; &lt;asp:Label ID="Label2" runat="server" Text="Your City" AssociatedControlID="TextBox1"&gt;&lt;/asp:Label&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" Text="*"&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;br /&gt; &lt;asp:Button ID="Button1" runat="server" Text="Submit in this page" OnClick="Button1_Click" /&gt; &lt;asp:Button ID="Button2" runat="server" Text="Submit in city page" PostBackUrl="~/CityPage.aspx" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In Second Page</p> <pre><code>&lt;%@ Page Language="C#" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script runat="server"&gt; protected void Page_Load(object sender, System.EventArgs e) { TextBox PP_TextBox1; PP_TextBox1 = (TextBox)PreviousPage.FindControl("TextBox1"); Label1.Text = "Your City: " + PP_TextBox1.Text; } &lt;/script&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;City Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;h1&gt;City Page&lt;/h1&gt; &lt;asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="Crimson"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>i think this will help you....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload