Access Session value in JavaScript function in ASP.Net

Last Reply one year ago By onais

Posted one year ago

i am getting the value in Master Page

string ab = (string)Session["UserID"]; 

i want pass the "ab" variable  value to javascript function and

if (ab > 0)

{ No change




disable <li class >



Posted one year ago


protected void Page_Load(object sender, EventArgs e)
    string ab = (string)Session["UserID"]; // Read session
    Session["myValue"] = ab;


<script type="text/javascript">
    var yourSessionValue = '<%= Session["myValue"] %>';