set session value in javascript  
Author Message
MeeNge





PostPosted: JScript for the .NET Framework, set session value in javascript Top

Hi,

I have one aspx page(main.aspx) that contaion one check box(chkStatus). I will call another page(popup.aspx) by clicking a button(btnPrint) with javascript:wondow.open() method. The things i would like to know is that if I check chkStatus I want to save value in session variable. I will use that session value in popup page.

I try like this, but it doesn't work.

chkStatus.Attributes.Add("onclick", if(chkStatus.checked== true){ <%Session(""status"") = ""MyStatus""%> ;}")

Any idea I am in urgent.

Thanks,

MeeNge



.NET Development23  
 
 
farzaddfgfdfgdfsdfsadf





PostPosted: JScript for the .NET Framework, set session value in javascript Top

You have to use server-side programming (vb.net or C# or ...). Maybe is better you use a button in asp.net .
 
 
Dinesh_India





PostPosted: JScript for the .NET Framework, set session value in javascript Top

Hi
you can not assign value to session variable from java script.
The reason is very clear session is store on server .So to assign session value you need post back .

However you can assign value of session variable to java script variable.






 
 
Huseyin Gedikli





PostPosted: JScript for the .NET Framework, set session value in javascript Top

If you want only getting checkbox's checked property, you can use window.opener.document.getElementById("chkBoxID")  to getting checkbox object in opened popup page
or you can send this value by querystring ( window.open("popup.aspx checked="+checkbox.checked) )

You cannot assign a value to session at client side.But you can set that value to cookie at client, and then you should get it from server.