Loading ...

Difference between Literal and Label in ASP.NET | CodeAsp.Net

Difference between Literal and Label in ASP.NET

 /5
0 (0votes)

Literal Control: It is used to display data; it is lightweight and does not make any formatting techniques. Literal control will render only its text which is assigned in its text property.

For example:

<div>

<asp: Literal ID="Literal1" runat="server" Text="This is a literal control">

</asp: Literal>

</div>

this code render as:
<div> This is a literal control</div> 

Label Control: It is also used for display data, it makes formatting techniques when it render. It will render text within span tag.

For example:  

<div>

<asp: Label ID="Literal1" runat="server" Text="This is a label control">

    </asp: Label>

</div>

this code render as:
<div><span>This is a label control </span></div> 


Comments (1)

   
james
james
Thanks heaps.. I was confused before as to why some ppl use one and some the other 
7/11/2010
 · 
by
  • :*
  • :*
  • :
 *

Top Posts