Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I pass the value into the next page, and how do I use the value in the next page? I want to pass an name from the first page to the next.

i want to use session
Posted
Updated 1-Apr-14 6:05am
v2

 
Share this answer
 
 
Share this answer
 
In server side you can use session
eg: webpage1

Session["name"]=textbox.text;

you can access this value in page 2 by'

string name=Session["name"];


in client side you can use Querystring,hiddenfield,Viewstate etc

eg: Querystring

page1: Response.Redirect("page2.aspx?name='"+ textbox2.text +"'");


in page 2;
string name=Request.Querystring["name"].tostring();
 
Share this answer
 
Try this:

Page 1:
C#
Session["name"] = "name"; //assign value here


Page 2:
C#
string username = Session["name"].ToString();


and see this:
http://www.nullskull.com/a/10400710/eight-different-ways-to-transfer-data-from-one-page-to-another-page.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900