Is it any point to use data in an asp:label

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hello!

If I have this web server control with a value of Type:
<asp:Label ID="Label1" runat="server"> Type:
</asp:Label>

then this control use the property text to set it to Type:
<asp:Label ID="Label1" runat="server" text="Type:" />

So are these two ways the same thing ?

//Tony
 
El jueves, 19 de abril de 2012 03:14:53 UTC+2, Arne Vajhøj escribió:
I have never seen the first form used - always the
second form.

The topic is discussed here:

http://stackoverflow.com/questions/986450/do-you-really-need-a-text-attribute-in-an-asp-net-label

Arne

Having read Arne's link, I think the main diference is that if you want to make localization you must use the Text property.

Explicit localization
<asp:Label ID="Label2" Runat="server" Text="<%$ Resources:LocalizedText, Msg1%>" />

Implicit localization
<asp:Button ID="Button1" Runat="server" meta:resourcekey="ButtonResource1" Text="English Button" />
 
Back
Top