What is the difference between Label and Literal Control in ASP.Net?
Label Control
This control will be rendering the text within a span tag to the browsers. Hence, it is possible to apply styles/stylesheet class to the rendered output.
Literal Control
Literal control will render its text as it is that is assigned to its text property. For example,
<div>
<asp:Literal ID="Literal1" runat="server" Text="Literal"></asp:Literal></div>
The above code will be rendered as,
<div>
Literal
</div>
Literal control is light weight because it does not have any additional overheads like Label control and it emits whatever is assigned to the Text property.
Since, the Label control is rendered as span tag with id; it is possible to handle it with javascript in client side.
|