SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why does asp.net server controls get rendered as <span> tag???

    Hello dear folks,

    I am learning a lot in Javascript from this site.

    I just realized that the asp server controls like <asp Label> control gets rendered out as a <span> tag.

    I know <asp Label> is a server control and not a HTML control. Does all server controls get rendered onto HTML <span> tag?

    can someone point me to any links/knowlegebase about this concept...totally surprised.
    thanks

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,649
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The reason labels get rendered inside tags is they needed some way to support the visual properties. They can actually also render as html labels if you use the right property who's name I am not recalling. In any case, that is probably the only time one should be using label controls. Unfortunately most of the tutorials just go there and forget about the much more useful literal control which just puts your text on the page sans any wrapping element.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Location
    Melbourne, Australia
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They can actually also render as html labels if you use the right property who's name I am not recalling.
    AssociatedControlID

    You should use an <asp:Literal> if you don't want any wrapping element.

  4. #4
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This thread should be moved to the DotNet forum


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •