Nov 03, 2011, 4:59 PM
[CLOSED] Label's "HTML" property drops certain HTML Formatting When Set
Hello,
Having a bit of an issue with the Label control. I am trying to use it to display some HTML code but it seems to be dropping certain characters, or not displaying things correctly. I've got a quick code sample below to demonstrate the problem. This code displays a very simple bulleted list:
I've got a Label.HTML property set in code-behind, on the page, and then just some straight HTML. Interestingly enough, the straight HTML is also exibiting this problem.
So what am I doing wrong here? I need all HTML entered in these labels to appear in the "standard" way.
How they appear:
How they should appear:
Thanks for any help.
Having a bit of an issue with the Label control. I am trying to use it to display some HTML code but it seems to be dropping certain characters, or not displaying things correctly. I've got a quick code sample below to demonstrate the problem. This code displays a very simple bulleted list:
<%@ Page Language="vb" AutoEventWireup="false" Inherits="ArticlePublisher.Demo" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblHTMLContents.Html = "<p>Test List:</p><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>"
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<ext:ResourceManager runat="server" />
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:Label runat="server" ID="lblHTMLContents" />
<ext:Label runat="server" Html="<p>Test List:</p><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>" />
<p>Test List:</p><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>
</div>
</form>
</body>
</html>
If you run the code you will see that the typical indent and bullets that should appear do not.I've got a Label.HTML property set in code-behind, on the page, and then just some straight HTML. Interestingly enough, the straight HTML is also exibiting this problem.
So what am I doing wrong here? I need all HTML entered in these labels to appear in the "standard" way.
How they appear:
How they should appear:
Thanks for any help.
Last edited by Daniil; Nov 03, 2011 at 5:28 PM.
Reason: [CLOSED]