Will you please provide me an example on Page.PreviousPage ?

Posted by Mahe under C# on 4/26/2013 | Points: 10 | Views : 1194 | Status : [Member] | Replies : 4
Hi All,

Will you please provide me an example on Page.PreviousPage ?
As I always get the control value on retrieving from previous page as null, even the control property set to public.

Regards,
Mahe




Responses

Posted by: Santhi on: 4/26/2013 [Member] Starter | Points: 25

Up
0
Down
Hi

Refer this link:

http://www.codeproject.com/Articles/14092/Cross-Page-Posting-in-ASP-NET-2-0

Thanks & Regards,
Santhi .V

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santhi on: 4/26/2013 [Member] Starter | Points: 25

Up
0
Down
Hi

This is a simple example:

Design page:

   <div>



<asp:Label ID="Label1" runat="server" Text="Name">

</asp:Label><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="Submit" PostBackUrl="~/WebForm2.aspx" />
</div>


CS Page : Ur Weform2 page Coding:

protected void Page_Load(object sender, EventArgs e)

{
TextBox name = (TextBox)PreviousPage.FindControl("TextBox1");Response.Write("Hi " + name.Text);
}


Thanks & Regards,
Santhi .V

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mahe on: 4/26/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Santhi,

I have tried, but I get null value for the "name" variable as declared.
I am using vs2010, is there any restriction on it ?

Regards,
Mahe

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santhi on: 4/26/2013 [Member] Starter | Points: 25

Up
0
Down
Hi

There is no restriction..
I am also using vs2010...
Can you post your code..


Thanks & Regards,
Santhi .V

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response