Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have written following code let say in Page 1
<script type="text/javascript"> function setSessionValue() { var selectedCarNoideId = "1026"; <%Session["BannerNoideID"] = "'+ selectedCarNoideId +'";%> alert('<%=Session["BannerNoideID"]%>'); } </script>
And now retrieving session value on other page (Scripting File .chtml) using following code.
<h2>Session-:@Session["BannerNoideID"] </h2>;
In the Page 1 alert PopUp displays "1026" as session value
But In Page 2
"Session-:'+ selectedCarNoideId +'"
Am I missing any thing ?
HI,
You can't set session side session variables from Javascript. I notice some of the code you've posted is from this link.. http://stackoverflow.com/questions/15519454/how-can-i-access-session-variables-and-set-them-in-javascript
Read the comments further down. If you want to do this you need to create an AJAX POST to update this on the server though if the selection of a car is a major event it might just be easier to POST this.
Steve
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" button below.
Continue discussion
Set Session value using Javascript and retrieving the same using razor umbraco
I have written following code let say in Page 1
And now retrieving session value on other page (Scripting File .chtml) using following code.
In the Page 1 alert PopUp displays "1026" as session value
But In Page 2
tag display following value as a output of session .
"Session-:'+ selectedCarNoideId +'"
Am I missing any thing ?
HI,
You can't set session side session variables from Javascript. I notice some of the code you've posted is from this link.. http://stackoverflow.com/questions/15519454/how-can-i-access-session-variables-and-set-them-in-javascript
Read the comments further down. If you want to do this you need to create an AJAX POST to update this on the server though if the selection of a car is a major event it might just be easier to POST this.
Steve
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" button below.
Continue discussion