CODEDIGEST InstallShield
Home Articles CodeDigest Tutorials InstallShield FAQs
Skip Navigation LinksHome » FAQs » What is the difference between Label and Literal Control in ASP.Net?   You are not logged in.
Search
 

Sponsors
InstallShield
 

Technologies
 

CodeDigest Navigation
 

Technology News
No News Feeds available at this time.
 

Community News
No News Feeds available at this time.
 
What is the difference between Label and Literal Control in ASP.Net?
What is the difference between Label and Literal Control in ASP.Net?
Submitted By Satheesh Babu
On 1/16/2009 8:30:57 AM
Tags: Interview Questions,ASP.Net  

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.