HTML embedded in C# dot net visual studio

Asked

Viewed 105 times

0

I need to generate a dynamic HTML in a C# application implemented in Visual Studio.

In case, I need to display the tag li as logged in user (Session).

The code is:

<%if (Session["usuario"] != null) {
    <li><a href="<%= ResolveUrl("~/Paginas/Contratos.aspx") %>">
        <img src="<%= ResolveUrl("~/images/chama.png") %>" class="chama" />
        <span>Contratos</span></a><br class="clear" />
    </li>
}%>

1 answer

0

Try to do the following:

<li> <%= ((Usuario)Session["usuario"]).Nome %> <li/>

Where Usuario is the type of data contained in Session "user" and the Nome is the property in the class Usuario.

  • William, thank you for your attention. I actually need the following: <%if (Session["user"] != null) { <li><a href="<%= Resolveurl("~/Pages/Contracts.aspx") %>"> <img src="<%= Resolveurl("~/images/chama.png") %>" class="flame" /><span>Contracts</span></a><br class="clear" /> </li> } } %>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.