How do I use Page1 variable in Page2?

Posted by Gaddad under ASP.NET on 4/29/2009 | Views : 968 | Status : [Member] | Replies : 5
I want to use page1 variable in page2




Responses

Posted by: Vuyiswamb on: 4/29/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Morning Gaddad

Use a Session Variable like this

Page 1

Session["Page1_Variable"] = 123;


and in Page 2 you want to Access that variable , you will do it like this


Page 2


int Page2_int = Convert.ToInt32(Session["Page1_Variable"]) ;


Thank you for Posting the at Dotnetfunda

Vuyiswa Maseko





Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Gaddad on: 4/29/2009 [Member] Starter

Up
0
Down
Thanks a lot.....

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

Posted by: Vuyiswamb on: 4/29/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
You are welcome :)

Thank you for Posting at Dotnetfunda


Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Syedshakeer on: 5/2/2009 [Member] Starter

Up
0
Down
Hi

Passing value from 1st page to 2nd page

int a=10;
Response.Redirect("2ndpage.aspx?avalue="+a);


2ndPage:
-----------

int val=Request.QueryString["avalue"];

Syed Shakeer Hussain

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

Posted by: Gaddad on: 5/4/2009 [Member] Starter

Up
0
Down
Thanks....

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

Login to post response