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. Advertisements

  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. Advertisements

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:
    756
    Henke
    May 5, 2004
  2. ALok Gupta via .NET 247
    Replies:
    2
    Views:
    1,322
    John Saunders
    Aug 9, 2004
  3. Craig
    Replies:
    1
    Views:
    3,711
  4. Replies:
    1
    Views:
    10,299
    Brock Allen
    May 24, 2005
  5. Steve Hershoff

    asp:Label - how can I get the Text property?

    Steve Hershoff, Nov 3, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    591
    Laurent Bugnion
    Nov 6, 2006
  6. CSharpner
    Replies:
    0
    Views:
    1,394
    CSharpner
    Apr 9, 2007
  7. Jim Higson
    Replies:
    3
    Views:
    382
    Eric Amick
    Jul 25, 2004
  8. Knut Krueger
    Replies:
    8
    Views:
    612
    Knut Krueger
    Aug 20, 2013
Loading...