Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

Can you please help me? i've been working this for a couple of days, yet can't solve it. I have Dropdownlist, is it possible that everytime i select dropdownlist it will create a session thru javascript. it will overwrite the current value after i select item on dropdownlist. with no button intervention.. is that possible? please help.. i'm using MVC3 (c#). please guide me.. thanks.

regards,
-naijeru-
Posted
Updated 23-Sep-12 17:29pm
v2

XML
var myvar = "Hey Buddy";

    '<%Session["temp"] = "' + myvar +'"; %>' ;

    alert('<%=Session["temp"] %>');

Does this really work?  the javascript is executing on the client side.
 
Share this answer
 
I think you misunderstood the concept of session. Session is a server side per-user-data-store which allows you to save user data on the server side. You can store and read string information in a cookie. Just try storing value in the cookie and in page load only find the cookie(if exists) and replace the session value.


--Amit
 
Share this answer
 
Quote:
To hiredotnet,

thanks.. i'll it.

Quote:
To _Amy,

maybe i misunderstood.. :D actually i use that one because i need the value of dropdownlist later on next page..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900