asp.net mvc - How to write code in html for retrieving the session value.? -
i have default2.cs file stores value in session
textbox1.text = "haii"; session["name"] = textbox1.text;
and need retrieve in html page- default.aspx
<script runat="server"> sub page_load string na=(string)session["name"]; label1.text=na; end sub </script>
it shows error 'string' class type , cannot used expression. please help
try in html in defaul.aspx,
<% string na=(string)session["name"]; %> <label id="label1"><% =na %></label>
Comments
Post a Comment