Lable
System.Object
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
System.Web.UI.WebControls.Label
System.Web.UI.WebControls.WebControl
System.Web.UI.WebControls.Label
<asp:Label ID="lblFirstName" runat="server" CssClass="myCssClass"Text="First Name" />
Literal
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.Literal
<asp:Literal id="litFirstName" runat="server" Text="First Name" />System.Web.UI.Control
System.Web.UI.WebControls.Literal
Now, bind your controls with some text :-
lblFirstName.Text = "text";
litFirstName.Text = "text";
Output will be show html of page run-time :
<span id="lblFirstName">text</span>
<br />
text
------------------------------------------------------------------------------
we see that the label text is wrapped around a span tag and
the literal text is simply putting a text in it.
label control has much more properties than the literal control,
so choose wisely.
No comments:
Post a Comment