I am wrting a few new web forms in C#asp.net 2010 and I am working with a formview and detailview controls. I have changed some columns to template fields and now I am working with them. What I would like to know if I can take a session variable and/or a local variable and place it in the location in the item template where the database column is obtained from?
The following is an example:
' >
Basically is there a way to replace '<%# eVAL(Session["CompanyName") %>'>' with a value that would have been obtained from the database? If so, how would you code this? if not, what is your suggestion besides forcing a database column to have this data just to show the value on a web form page?
Sie StePosted Nov 5, 2011, 7:02 PM
session property?
I do not know how to do that in code.
Prabhu RajaPosted Nov 4, 2011, 10:48 PM
You may try with the use of Properties. Define a property in Code Behind,
public string SessionValue
{
get
{
return Session["CompanyName"].ToString();
}
}
And Call this Property from