Label Text Property and entities

Discussion in 'ASP .Net' started by Rene, Feb 25, 2009.

  1. Rene

    Rene Guest

    The following asp label fail to display in the browser, can someone please
    tell me what I am doing wrong. I expect to see the value "<abc>" but instead
    I get nothing.

    <asp:Label ID="Label1" runat="server" Text="&lt;abc&gt;"></asp:Label>

    Thank you.
     
    Rene, Feb 25, 2009
    #1
    1. Advertising

  2. re:
    !> I expect to see the value "<abc>" but instead I get nothing.

    Try it like this :

    <asp:label id="Message1" runat="server"> &lt;abc&gt; </asp:Label>

    or... do it programmatically :

    Sub Page_Load(obj as object, e as eventargs)
    Label1.Text = Server.HtmlEncode("<abc>")
    End Sub

    <asp:Label id="Label1" runat="server"></asp:Label>




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    =========================
    "Rene" <> wrote in message news:O$...
    >
    > The following asp label fail to display in the browser, can someone please tell me what I am doing wrong. I expect to
    > see the value "<abc>" but instead I get nothing.
    >
    > <asp:Label ID="Label1" runat="server" Text="&lt;abc&gt;"></asp:Label>
    >
    > Thank you.
     
    Juan T. Llibre, Feb 25, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henke
    Replies:
    1
    Views:
    656
    Henke
    May 5, 2004
  2. ALok Gupta via .NET 247
    Replies:
    2
    Views:
    1,175
    John Saunders
    Aug 9, 2004
  3. CSharpner
    Replies:
    0
    Views:
    1,148
    CSharpner
    Apr 9, 2007
  4. Jim Higson
    Replies:
    3
    Views:
    251
    Eric Amick
    Jul 25, 2004
  5. Knut Krueger
    Replies:
    8
    Views:
    341
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page