top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is the difference between Label control vs literal control in ASP.Net?

+2 votes
319 views

Also want to know how is it used?

posted May 12, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+3 votes
 
Best answer

Difference between Label and Literal controls in ASP.Net
Label control
1. Label control (by default) is rendered as HTML Tag i.e. the Text is enclosed within the HTML Tags. When AssociatedControlID property is set for the Label control it is then rendered as HTML

Literal control
1. Literal control is rendered as is i.e. it is not enclosed within any HTML Tags.
2. Literal control cannot be styled as it does not use any HTML tag.
3. Literal control in spite of giving ID is rendered without ID hence cannot be accessed via JavaScript or jQuery.
4. Generally used for adding HTML content on page for example suppose you want to add HTML

Tag and if you would use Label it would not be correct HTML since as per W3C Standards an HTML
cannot be rendered within a or
answer May 29, 2014 by Asmita Agrawal
Similar Questions
+4 votes

What is the difference between <asp:Panel > and <asp:PlaceHolder > in ASP.NET? When should you use one over the other?

0 votes

How to get all values along with control Id using Jquery in ASP.NET?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...