Sunday, 17 April 2016

Difference between Label and Literal control in Asp.Net

difference between Label and Literal control in Asp.Net

Description:



In this example we explain that what is the difference between Label and Literal control in Asp.Net.
Or where and when to use Label control and when to use Literal control in asp.net.
Below is the difference between Label and Literal control in asp.net

Label
Literal
Label control is rendered as HTML tag means Text of the Label is enclosed within HTML <span> tag. When AssociatedControlID is not set for the Label control then it is rendered as the <label> tag.
Literal control is not enclosed within HTML tags
You can easily style within Label control.
Literal control cannot be styled.
Label control is easily used in a JavaScript or jQuery in client side scripting.
Literal control is not accessed by the JavaScript or jQuery.
Used for displaying Text or message.
Generally used for displaying HTML tags.

 

0 comments:

Post a Comment