Struggling to retrieve the session value in my asp.net
code behind using JavaScript. The syntax seems incorrect and I cannot figure out how to access the session value.
I attempted to invoke JavaScript on page load, which worked without issues. However, when trying to assign the variable value as a session value, the alert box is not being triggered. It appears that I made an error somewhere, but I am unsure of what it might be.
Below is the snippet from the code behind:
str += "<script type='text/javascript'>" +
//"alert('testing');" +
"var sesindex = '<%=Session["indexval"]%>';" +
"alert(sesindex);" +
"</script>";
My objective is to set the value of sesindex
and display it in an alert box. Even though it works fine on an HTML page, the functionality fails within the code behind.