label versus asp:label Question. Thanks.

Discussion in 'ASP .Net' started by Shapper, May 7, 2005.

  1. Shapper

    Shapper Guest

    Hello,

    I am creating a contact form in ASP.NET and I need to access the labels
    on Page_Load on my aspx.vb file.

    The other elements such as input box and text box don't need to be
    accessible.

    What are the advantages of using HTML tags such as <label> over the
    ASP.NET tags such as <asp:label>?

    I am asking cause if it is the same I would always use the asp tags so
    if in the future I would need to access them from Page_Load I wouldn't
    need to change the tags again.

    Thanks,
    Miguel
     
    Shapper, May 7, 2005
    #1
    1. Advertising

  2. HTML controls are slightly more efficient.
    If performance is your top priority then you should pretty much always use
    HTML controls when you don't need the advanced capabilities of the
    equivalent web control.
    Here's more info:
    http://steveorr.net/faq/3in1.aspx#HTMLvsWeb

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    news:%...
    > Hello,
    >
    > I am creating a contact form in ASP.NET and I need to access the labels on
    > Page_Load on my aspx.vb file.
    >
    > The other elements such as input box and text box don't need to be
    > accessible.
    >
    > What are the advantages of using HTML tags such as <label> over the
    > ASP.NET tags such as <asp:label>?
    >
    > I am asking cause if it is the same I would always use the asp tags so if
    > in the future I would need to access them from Page_Load I wouldn't need
    > to change the tags again.
    >
    > Thanks,
    > Miguel
    >
     
    Steve C. Orr [MVP, MCSD], May 7, 2005
    #2
    1. Advertising

  3. There are actually a few differences. The asp:Label renders as a
    <span> tag. Regarding the <label> HTML tag, I assume you mean you will
    be using HTML markup and NOT the server-side HTML controls? If so, as
    Steve mentioned, these are a bit more performant, but they cannot be
    accessed programmatically, as you noted.

    Personally I use HTML markup for any content that doesn't need to be
    accessed by server-side script, but I know people who like to use
    asp:Labels because the VS.NET designer allows you to drag and drop them
    and move them around with greater ease than vanilla HTML markup.

    Really it's a style of preference. Assuming you don't need to access
    the content programmatically, do whichever approach you prefer,
    although I'd opt to use the HTML markup myself...
     
    Scott Mitchell [MVP], May 7, 2005
    #3
    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. Matthew Louden
    Replies:
    1
    Views:
    7,006
    Scott M.
    Oct 11, 2003
  2. Russ

    script versus code versus ?

    Russ, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,522
  3. Christoffer Sawicki
    Replies:
    5
    Views:
    273
    Christoffer Sawicki
    Sep 2, 2006
  4. Paul Butcher
    Replies:
    12
    Views:
    752
    Gary Wright
    Nov 28, 2007
  5. Knut Krueger
    Replies:
    8
    Views:
    295
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page