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

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
 
A

Arne Vajhøj

B

bradbury9

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" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top