When the code var accNo = '<%=Session["hdnAccession"]%>'; will be executed ?. I change the session variable in the Page_LoadComplete event, but when I access it using var accNo = '<%=Session["hdnAccession"]%>';, it always return the value which I set FIRST. In Page_LoadComplete, I do like the following… Session["hdnAccession"] = GetNewAccession(), When I debugged, I saw that the Session["hdnAccession"] updated each time. But why it do not get updated in JavaScript ?. I am in a situation where I can not use HiddenField instead of Seession.
When the code var accNo = ‘<%=Session[hdnAccession]%>’; will be executed ?. I change the
Share
You need to create a PostBack to access session variables from JS. Like so:
See here: http://forums.asp.net/post/2230824.aspx