asp.net - Assign TextBox Value to the session in MVC -
in mvc application used input type textbox , need assign value session how?
im using code like
<input type="text" id="textbox1" name="namebox" /> <input type="text" id="textbox2" name="agebox" /> <% httpcontext.current.session["name"] =textbox1; %> <% httpcontext.current.session["age"] = textbox2; %>
but got error pls on this....
why prefer session instead of hidden input box? well, think should use name rather id of textbox.
try , let me know if there problem.
<input type="text" id="textbox1" name="namebox" /> <input type="text" id="textbox2" name="agebox" /> <% httpcontext.current.session["name"] = namebox; %> <% httpcontext.current.session["age"] = agebox; %>
Comments
Post a Comment