在xsl页面上的javascript中访问会话值 [英] Access session value in javascript on xsl page

查看:93
本文介绍了在xsl页面上的javascript中访问会话值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xsl页面。



HttpContext.Current.Session.Contents [" USERID"] =" Manager";



现在,

我想在xsl页面上使用javascript在其他页面上访问此值。

我按照以下方式进一步:

var someSession ='<%= HttpContext.Current.Session [" USERID"]%>';

alert(someSession);



但我没有得到会话的价值....而是我得到了

<%= HttpContext.Current.Session [" USERID" ;]%>在警报框中。



如何进一步处理?

I am working on xsl page.

HttpContext.Current.Session.Contents["USERID"]="Manager";

Now,
I want to access this value on other page using javascript on xsl page.
I went further in following manner:
var someSession = '<%= HttpContext.Current.Session["USERID"] %>';
alert(someSession );

But I am not getting the value of session....instead I am getting
<%=HttpContext.Current.Session["USERID"] %> in the alert box.

How can I approach further?

推荐答案

如果您编写警报,这是一个客户端代码,所以我相信将会话值存储到隐藏控件中(然后尝试通过隐藏控件的名称访问此值,你应该得到它。
If you write the alert, this is a client side code, so I belive store that session value into a hidden control ( and then try accessing this value through name of hidden control, you should get that.


必须使用xsl页面上的隐藏字段变量,然后通过创建xmlnode在会话后面的代码中为其分配值。
Had to use a hidden field variable on xsl page and then assign it value in code behind page from session by creating a xmlnode.


这篇关于在xsl页面上的javascript中访问会话值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆