Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Someone tell me that how to transfer values between pages in asp.net?

Thanks.
Posted
Updated 19-Apr-11 6:47am
v2

You have numerous of options to do that.


In order to get the general idea have a look at this page in msdn;

ASP.net State Management Overview[^]

ASP.net session state overview[^]

State management[^]

Session overview[^]

A basic code example is;
This is an example of Session;

object sessionObject = Session["someObject"];

if (sessionObject != null) 
{ 
   myLabel.Text = sessionObject.ToString(); 
}
 
Share this answer
 
v3
Or if you don't want to use state, you can pass from page to page using QueryString (very common technique to reduce state management overhead)

Passing variables between pages using QueryString[^]
 
Share this answer
 
Mainly Session and Query String is used to transfer data.
C#
Response.Redirect("Abc.aspx?ID=2");

And in Abc.aspx
C#
String ID = Request.QueryString["ID"];

And
C#
Session["ID"]=ID;

in next Page
C#
String ID = Session["ID"].ToString();
 
Share this answer
 
v3

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