getting object property from session var in HTML
I have a user object that gets instantiated / initialized on login.
In the HTML am trying to figure out how to take that session var / object called currentUser and get the FirstName property.
I tried: myFunction('<%= Session["currentUser"].FirstName %>');
... and I get this error:
CS0117: 'object' does not contain a definition for 'FirstName'
I know that the object exists in the session, the property exists in the object because I can write to a label from the code-behind without any trouble.
What else might be going on here?
I think the object should be casted to the real type first before accessing the property. Assuming that the class for user is named UserInfo, then you should do this ((UserInfo)Session["currentUser"]).FirstName. You might need to supply the full name of the class, including the namespace..
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL