[CLOSED] Set label.Html from code behind

  1. #1

    [CLOSED] Set label.Html from code behind

    Hi,

    I'm trying to set the Html property in the code behind. Instead of showing as html is shows the tags. When I set the Html in the markup it does work.

    I'm using the new <bin> feature to keep my code modular.

    What shoud I change to get this to work correctly?

    Marc

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestNetHtml.aspx.cs" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
       
    <script runat="server" language="c#">
        protected void ShowWindowA(object sender, DirectEventArgs e)
        {
            lbHtmlInfo.Html = "<br/> This does not work </b>";
            winA.Show();
        }
        protected void ShowWindowB(object sender, DirectEventArgs e)
        {
            winB.Show();
        }
    </script>
        
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
       
            <ext:ResourceManager ID="ResourceManagerExt" runat="server" />
            
            <ext:Panel runat="server" Title="Popup">
                <Items>
                 <ext:Button  runat="server" Text="ShowPopupA">
                    <DirectEvents>
                        <Click OnEvent="ShowWindowA"></Click>
                    </DirectEvents>
                </ext:Button>
                    
                    <ext:Button  runat="server" Text="ShowPopupB">
                    <DirectEvents>
                        <Click OnEvent="ShowWindowB"></Click>
                    </DirectEvents>
                </ext:Button>
                </Items>
                    <Bin>
                        
                    <ext:Window ID="winA" runat="server" Width="500" Modal="True" Layout="Form" Title="Does not work" DefaultRenderTo="Body" Resizable="False">
                    <Items>
                        <ext:Label ID="lbHtmlInfo" runat="server" Height="200"></ext:Label>
                        <ext:FormPanel runat="server" Border="False" DefaultAnchor="95%" BodyPadding="10" LabelWidth="200">
                            <Items>
                                <ext:TextField runat="server" Flex="1" FieldLabel="Period" />
                             </Items>
                        </ext:FormPanel>
                    </Items>
                    <Buttons>
                         <ext:Button ID="Button2" runat="server" Text="Close" Handler="#{winA}.close();" />
                    </Buttons>
                    </ext:Window>
                        
                        
                     <ext:Window ID="winB" runat="server" Width="500" Modal="True" Layout="Form" Title="Works" DefaultRenderTo="Body" Resizable="False">
                    <Items>
                        <ext:Label ID="Label1" runat="server" Html="<b>This works</b>"  Height="200"></ext:Label>
                        <ext:FormPanel ID="FormPanel1" runat="server" Border="False" DefaultAnchor="95%" BodyPadding="10" LabelWidth="200">
                            <Items>
                                <ext:TextField ID="TextField1" runat="server" Flex="1" FieldLabel="Period" />
                             </Items>
                        </ext:FormPanel>
                    </Items>
                    <Buttons>
                         <ext:Button ID="Button1" runat="server" Text="Close" Handler="#{winB}.close();" />
                    </Buttons>
                </ext:Window>
                </Bin>
            </ext:Panel>
       
        </form>
    </body>
    </html>
    Last edited by Baidaly; Dec 18, 2013 at 7:05 PM. Reason: [CLOSED]
  2. #2
    try

    lbHtmlInfo.Update("<br/> This does not work </b>")
    instead of

    lbHtmlInfo.Html = "<br/> This does not work </b>"
  3. #3
    Hi everybody,

    Yes, the Update call can help. Thank you for the attention, @blueworld!

    Though, I think it is a defect. Fixed in the trunk.

    Also you missed an opening <b> tag here:
    lbHtmlInfo.Html = "<br/> This does not work </b>"
  4. #4
    Thank you.

    lbHtmlInfo.Update() Solved my problem.

    Marc
    Last edited by geoffrey.mcgill; Dec 18, 2013 at 5:59 PM.

Similar Threads

  1. [CLOSED] Get size of label when setting HTML...
    By rthiney in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 07, 2013, 4:17 AM
  2. [CLOSED] Html code to Ext:label
    By canbay in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 26, 2012, 1:08 PM
  3. Problem with set Html in Label
    By manhhoangxuan in forum 1.x Help
    Replies: 12
    Last Post: Mar 29, 2012, 10:32 PM
  4. Replies: 2
    Last Post: Nov 03, 2011, 5:24 PM
  5. unescape label html
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Apr 15, 2010, 3:11 AM

Tags for this Thread

Posting Permissions