Click here to Skip to main content
15,937,779 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi..

i have a one label. i would like to find that label current size. could you please help me?
Posted

1 solution

ASP.NET
<asp:label id="lbl" runat="server" font-size="10px" text="some text" xmlns:asp="#unknown"></asp:label>


in javascript :

HTML
var jquery = $('#lbl').css('font-size');
           // (or)
           var javascript = document.getElementById('lbl').style.fontSize;


c#:

C#
var siZe = lbl.Font.Size.Unit.ToString();


______________________________________________________________________________

if you html tag is like this

ASP.NET
<asp:Label ID="lbl" runat="server" Style="font-size: 15px" Text="some text"></asp:Label>


you can use:

C#
var df = lbl.Style["font-size"];
 
Share this answer
 
v2
Comments
Member 10453510 4-Jan-14 1:00am    
c# code is not showing anything it shows like "" onlye(only double quotes not showing any value)
Karthik_Mahalingam 4-Jan-14 2:27am    
post your label tag..
Karthik_Mahalingam 4-Jan-14 2:34am    
check my updated solution.

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