-
getting object property from session var in HTML
Hello,
I have a user object that gets instantiated / initialized on login.
I have a javascript function that needs to utilize some of the properties of that user object.
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?
tx
k
-
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..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks