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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -