[CLOSED] Label's "HTML" property drops certain HTML Formatting When Set

  1. #1

    [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:

    <%@ 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:
    Name:  Capture1.PNG
Views: 240
Size:  1.2 KB

    How they should appear:
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	112 
Size:	1.6 KB 
ID:	3399

    Thanks for any help.
    Last edited by Daniil; Nov 03, 2011 at 5:28 PM. Reason: [CLOSED]
  2. #2
    Hi,

    There are three options.

    1. Do not render styles at all setting RenderStyles="None" for a ResourceManager.

    2. Overriding css for a specified component setting a Cls property.

    3. Using a Panel and its PreventBodyReset property.
    http://docs.sencha.com/ext-js/3-4/#!/api/Ext.Panel-cfg-preventBodyReset

    Example
    <ext:Panel runat="server" PreventBodyReset="true">
        <Content>
            <p>Test List:</p><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>
        </Content>
    </ext:Panel>
    Last edited by Daniil; Nov 03, 2011 at 5:29 PM.
  3. #3
    Very good suggestions. Thank you Daniil. You can close this.

Similar Threads

  1. Replies: 2
    Last Post: Jul 25, 2012, 4:08 PM
  2. [CLOSED] How does "MaskCls" work for "AutoLoad" mask in panel control
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 19, 2012, 12:09 PM
  3. Replies: 1
    Last Post: Jun 26, 2012, 11:29 AM
  4. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  5. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM

Posting Permissions