How To retrieve Previous page value

Posted by Jayakumars under ASP.NET AJAX on 3/27/2013 | Points: 10 | Views : 1063 | Status : [Member] [MVP] | Replies : 4
Hi

I have tried like this

//Page1.aspx
===========================
Server.Transfer("Default2.aspx");

//Page2.aspx
====================
TextBox txt = (TextBox)PreviousPage.FindControl("txtJesus");


This is working good but i put response.redirect from Page1.aspx

i did not fetch the values how will do this?

Mark as Answer if its helpful to you


Responses

Posted by: aswinialuri-19361 on: 3/27/2013 [Member] Starter | Points: 25

Up
0
Down
hi

Try this i think you are asking transfer the values from one page to another page using response.redirect method
then better to use query string .

Thank you
Aswini Aluri

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

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

Posted by: Jitendrasoft09 on: 3/27/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
There are following code is working as expected requirement.

<asp:Button ID="button1" Runat=server Text="submit" PostBackUrl="~/Page.aspx" />
if(!IsPostBack)
{
TextBox tb = (TextBox)PreviousPage.FindControl("Text1");
}


Jitendra Kumar
If my post helps you, plz mark as an answer.

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

Posted by: Jitendrasoft09 on: 3/27/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Finally, Response.Redirect redirects page to another page after first page arrives to the client so data will lose as supports round trip, but Server.Transfer does not supports round trip so better to use Server.Transfer.


Jitendra Kumar
If my post helps you, plz mark as an answer.

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

Posted by: Snaveen on: 2/14/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

No.of ways you can get previous page values,

Out of that i give one simple example

Use Redirect method.
page1:

Response.Redirect("page2.aspx?id="+id);


Page2:

if(Request.QueryString["Id"]!=null)

string Id= Request.QueryString["id"].ToString();


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

Login to post response