javascript - Assigning an object to Session variable

R

RA

Session("ListBoxHold") = document.getElementById("lstCodes")

The above statement gives an error "Object Expected"

Any Clue?
 
R

RA

Well, many controls are on the server; but still we are able to exploit them
using javascript(on the client-side).
 
Y

Yama

Hi,

Try saving it to a cookie then retrieve it from code-behind.

Client-Side javascipt:
// Use this function to save a cookie.
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; path=/" +
((expires == null) ? "" : "; expires=" + expires.toGMTString());
}Server-Side c#public void GetCookie() { HttpCookie
aCookie = Response.Cookies["test"]; foreach (string s in
aCookie.Values.Keys) { Response.Write("Key: " + s
+ " Value: " + aCookie.Values + = "<P>"); } }Hope this
helps,Yama
 
Y

Yama

Sorry something happened there maing it hard to read:

// Client-Side javascipt:
// Use this function to save a cookie.
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; path=/" +
((expires == null) ? "" : "; expires=" +
expires.toGMTString());
}

// Server-Side c#
public void GetCookie(){
HttpCookie aCookie = Response.Cookies["test"];
foreach (string s in aCookie.Values.Keys){
Response.Write("Key: " + s + " Value: " + aCookie.Values + =
"<P>");
}
}


Hope this helps,

Yama





Yama said:
Hi,

Try saving it to a cookie then retrieve it from code-behind.

Client-Side javascipt:
// Use this function to save a cookie.
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) + "; path=/" +
((expires == null) ? "" : "; expires=" + expires.toGMTString());
}Server-Side c#public void GetCookie() { HttpCookie
aCookie = Response.Cookies["test"]; foreach (string s in
aCookie.Values.Keys) { Response.Write("Key: " +
s + " Value: " + aCookie.Values + = "<P>"); } }Hope
this helps,Yama
RA said:
Session("ListBoxHold") = document.getElementById("lstCodes")

The above statement gives an error "Object Expected"

Any Clue?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top