Click here to Skip to main content
16,015,274 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello all,
i have just creates a session variable. i want to give its value in html(design view). how to write session in html
Posted
Comments
Sunasara Imdadhusen 29-Oct-10 7:52am    
Not clear! you want to get session value and display any client object in HTML?

You can write it directly on the page:
Response.Write(Session["sessionName"].ToString());


But I prefer to use a Label (renders a span tag) ou a Literal (renders just the text property).

In HTML:
<asp:Label ID="lblResult" runat="server" />


And in the codebehind(c#):
C#
lblResult.Text = Session["sessionName"].ToString();
 
Share this answer
 
Hi
using HTML
<div>User Name:- <%= Session["UserName"] %></div>
XML
<div>User Name:- <%= Session["UserName"] %></div>


Please do let me know, if you have any doubt.

Please provide "Vote":thumbsup: if this would be helpful, and make "Accept Answer" if this would be correct answer.:rose:

Thanks,
Imdadhusen
 
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