View Single Post
Old 03-16-2017, 12:39 AM   #2
sonvi.belani
Registered User
 
Join Date: Jan 2017
Location: Ahmedabad
Posts: 95
Hi,

Cross page postback is the concept which is used to submit one page (Default.aspx) controls to another page (Default2.aspx) and access those page (Default.aspx) control values in another page (Default2.aspx).

Here I will explain this concept with simple example for that first create one web application and add two new pages Default.aspx and Default2.aspx.

=> Default.aspx

Quote:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Cross Page Postback Example in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td><b>Enter UserName:</b></td>
<td><asp:TextBox ID="txtUserName" runat="server"/></td>
</tr>
<tr>
<td><b>Enter Location:</b></td>
<td><asp:TextBox ID="txtLocation" runat="server"/></td>
</tr>
<tr>
<td></td>
<td><asp:Button ID="btnPostback" Text="Postback" runat="server" PostBackUrl="~/Default2.aspx" /> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
=> Default2.aspx

Quote:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Cross Page Postback Example in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<b><u>Default2.aspx Page</u></b><br /><br />
<label id="lblName" runat="server" /><br /><br />
<label id="lblLocation" runat="server" />
</div>
</form>
</body>
</html>
Run this code on your system and see whats happen.

Thanks
__________________
Sonvi Belani
Ecommerce Website Developer

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
sonvi.belani is offline   Reply With Quote