Html – ASP.Net literal. Insert html

By | October 22, 2023

I have simple literal on my page.

<asp:Literal ID="litDescription" runat="server"></asp:Literal>

When I am trying to set the following text to the literal:

<p><div>Some Text</div></p>

in my browser’s markup I see

<p></p>
    <div>Some Text</div>
<p></p>

Why there are two ‘p’ tags? I need to have

<p><div>Some Text</div></p>.

Best Solution

A div inside a P is invalid HTML.
I don’t think .net is making the

up.
I think it comes from your browser.

Category: Uncategorized