Click here to Skip to main content
15,896,445 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have label3 in page1. it contain an integer value 1. I want to pass that value to page2 and to perform some arithmetic operation with it

C#
Label3.Text = ("1");
                Session["s"] = Label3.Text;

this the code


What I have tried:

C#
int a=Session["sum"].ToString();
Posted
Updated 6-Dec-16 0:55am
v2

Your session value on page 1 is Session["s"] but on the second page you are calling the session identifier Session["sum"].

Either change your page 1 session identifier to 'sum' or your page 2 session identifier to 's'
 
Share this answer
 
Hi,

try this as per your code
C#
int a= (int)Session["s"].ToString();

In short , use proper session name and use proper type casting.
 
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