Get Value from one page and access anywhere through out Application:

Sathya4260
Posted by Sathya4260 under ASP.NET category on | Points: 40 | Views : 1963
Hi,

I write this code as an answer for the below forum,

http://www.dotnetfunda.com/forums/thread3492-previous-pages-values.aspx

We can use entity class to store the data from one page and access the variable(Data) through out the application,

This is done by the fallowing code,

Entity.cs

public static class Entity

private static int _Username;

public static int Username
{
get
{
return _Username;
}
set
{
_Username= value;
}
}

Assign the value in the local class as fallows:

entity.Username=txtusername.Text;

Then get the value of username anywhere in the apllication by just calling as

entity.Username

Hope this helps,If yes Response to this code...

Comments or Responses

Login to post response