Ways of setting Font as Bold to Label Text in Asp.Net.

Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 21583
There are 3 ways to set Text as Bold.

1st way:-
Directly write Font-Bold property in Label declaration.Font-Bold has True and False values.

For Example:-

<asp:Label ID="lbl_phone_number" runat="server" Text="1234567890" Font-Bold="true"></asp:Label>

2nd way:-
We can assign property at run-time.Label has Font.Bold static property.We can set it to True or False.

<asp:Label ID="lbl_adddress" runat="server" Text="Pune"></asp:Label>

In Code-Behind,

lbl_adddress.Font.Bold = true;

3rd way:-
Is the best way to format Label dynamically with <b> tag in starting and ending of Text as shown:-

<asp:Label ID="lbl_name" runat="server" Text=""></asp:Label>

In Code-Behind,

lbl_name.Text = "<b>" + "Vishal" + "</b>";

Comments or Responses

Login to post response