This topic is locked

need Help with sessions

4/21/2016 6:08:30 PM
ASPRunner.NET General questions
A
Arkie author

The help file in "Save user data in session variables" states

XSession.Session["FirstName"] = data["FirstName"];
Fine.... and I can see my data if I display the session variables.
But then it states:

Then you can use Session["FirstName"] as default value of any field or in other events.
When I try to use this as a default value on a page, It doesn't compile unless I use "XSession.Session" rather than just "Session" as in

XSession.Session["FirstName"]
Ok.. it compiles, but the value doesn't get passed as the default value to my database value on my page. I selected it to display as Read Only.
If I understood the sessions part better, maybe I can see why the default value doesn't get passed.
TIA...

Joe

T
Tim 4/21/2016

How about XSession.Session["FirstName"].ToString()

A
Arkie author 4/21/2016



How about XSession.Session["FirstName"].ToString()


thanks for the effort, but that didn't work either.
The strange part is that I've done this countless times before using this same process but this one just doesn't work.

I think I'll delete the entire page and give another try.
Is the help file wrong in stating to use "Session" and not "XSession.Session" ?
~Joe

jadachDevClub member 4/21/2016

How exactly are you setting it as the default value? Are you doing it at the field property setting or an event.

A
Arkie author 4/21/2016



How exactly are you setting it as the default value? Are you doing it at the field property setting or an event.



I'm setting it at the field property.

Maybe I should consider trying an event but I'm too much of a noobie to know what syntax to use. I'll need some study + trial & error.
No comment about the help file example??

Sergey Kornilov admin 4/21/2016

Correct syntax is XSession.Session["FirstName"]