Gday, can anyone help show me how to access session variable from java script. i have tried as in code below but no luck.
function wdgRegister_Selection_RowSelectionChanged(sender, eventArgs)
{
var vendor = eventArgs.getSelectedRows().getItem(0).get_cell(4).get_value();
<%Session("RegisterId") = vendor; %>
}
// -->
The above code is not working. can any one help. Thanks
Hello Ikenna,
Thank you for posting in our forum.
Session variables can be accessed on the client side. For example you could check the value by calling:
alert('<%=Session["RegisterId"] %>');
Anything between the "<%" and "%>" runs at the server so it will evaluate the current value of the session. However since it runs on the server it won’t be aware of any client side defined variables.
Ultimately the session only exists on the server side so I would advise you to not attempt to set it directly on the client. Instead use a hidden field to store the values you need and then access the hidden field value on the server side from where you can store it in session if needed.
Let me know if you have any questions or concerns.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Hi Maya,
Thanks for the tip, i have now decided to use server side code to assign the session variable. Thanks