Difference between label and literal controls in asp.net?

 Posted by aswinialuri-19361 on 4/23/2013 | Category: ASP.NET Interview questions | Views: 2916 | Points: 40

Label control renders text within span tag to browser. It is possible to apply style and style sheet class to label.
Literal will render it's text that is assign to text property. It cannot render any additional html tag. Default mode for literal is “Transform”. Best practice to set Mode="Encode" for literal control

It is best practice to use literal instead of Label control wherever it possible in asp.net application.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response