Click here to Skip to main content
15,921,643 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using html label in Asp.net website.
I want label Text property

but not like this

<label for="male">Male</label>.

How to declare text property for HTML label control ?

following is Asp label. I want asp label replace to HTML label
ASP.NET
<asp:Label ID="lblHeaderName" runat="server" ForeColor="White" Text="<%$ Resources:GlobalResources, lbl_FinalInspection %>"></asp:Label>


What I have tried:

<label for="male" val='Male'></label>

<label for="male" val="Male"></label>
Posted
Updated 24-Apr-16 19:04pm
Comments
Sergey Alexandrovich Kryukov 25-Apr-16 0:36am    
It makes no sense at all. You don't understand the purpose of label. It is needed to label some other element, a control.
—SA
priyadarshini tv 25-Apr-16 1:00am    
html label have no property like text

Check these

Code Blocks in ASP.NET[^]
Similar question answered earlier in Codeproject [^]

ASP
<label> 
            <%= DateTime.Today.ToShortDateString() %>
</label>



ASP
<label> 
            <%= Your Server Object %>
</label>
 
Share this answer
 
Comments
Pradeep_More 25-Apr-16 1:14am    
Yes this is working.
but i want Text from Resources file please sausage me how to get resources ?
Pradeep_More 25-Apr-16 2:54am    
Not using javascript. simple HTML label
Karthik_Mahalingam 25-Apr-16 2:56am    
bro its not javascript..
add this in your cs file
public string GetResource(string ResourceName, string ResourceKey)
{
string r = HttpContext.GetGlobalResourceObject(ResourceName, ResourceKey) as string;
if (r == null)
return ResourceKey;
return r;
}

add this in your aspx page

< label > <%= GetResource("ErrorMessages", "errorCompanyNotFound") %> < label >
Pradeep_More 25-Apr-16 3:00am    
not used cs file.
used .aspx file
You have no clue on what this element does. There is no such thing, and the whole question makes no sense.
To understand what it does, please read (in addition to my comment to the question), for example, Label — HTML | MDN[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900