calling session["id"] from javascript
-
i have a session["id"] in c# code behind file, i want to read this session from javascript. how can i do it thanks in advance.
haitham
-
i have a session["id"] in c# code behind file, i want to read this session from javascript. how can i do it thanks in advance.
haitham
-
i have a session["id"] in c# code behind file, i want to read this session from javascript. how can i do it thanks in advance.
haitham
You can assign this to a JavaScript variable and then use it.
Vasudevan Deepak Kumar Personal Homepage Tech Gossips
-
You can place the value of session["id"] in a hidden textbox in the code behind file. You can access the value of this textbox in javascript.
Wout Louwers
first thanking for your reply. if you hide the textbox and then read the value of this textbox from javascript, it is fail , it is succeeded only if the control is visible i made it using this line document.getelementById("controlid"). thanks
haitham
-
You can assign this to a JavaScript variable and then use it.
Vasudevan Deepak Kumar Personal Homepage Tech Gossips
thanks for ur attention to reply me the problem in accessing variable in code behind file from javascript thanks.
haitham
-
first thanking for your reply. if you hide the textbox and then read the value of this textbox from javascript, it is fail , it is succeeded only if the control is visible i made it using this line document.getelementById("controlid"). thanks
haitham
-
i have a session["id"] in c# code behind file, i want to read this session from javascript. how can i do it thanks in advance.
haitham
Unfortunately, you can't get js to talk to the server unless you use AJAX....the way to get around it is to use asp:HiddenFields on your page. If you need access to a server side variable, store it in one when you process on the server, then at the client, use document.getElementById to retrieve the value...
"Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox