Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variable in a ContentPlaceHolder 1

Status
Not open for further replies.

strtech

Technical User
Oct 30, 2006
27
US
Hi,

I am trying to capture a session variable that is located in a FormView that's part of a Master page. I know how to do session variables but the value is showing up as "System.Web.UI.WebControls.Label" instead of the value. What am I missing?

The code I used to declare the variable is:

Session("Meeting") = Master.FindControl("ContentPlaceHolder2").FindControl("FormView1").FindControl("MtgID")

Thanks in advance.
 
You need to cast the resulting control to it's correct type, and then define which property you want to add to the session variable:
Code:
Session("Meeting") = [!]Ctype([/!]Master.FindControl("ContentPlaceHolder2").FindControl("FormView1").FindControl("MtgID")[!], Label).Text[/!]


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top