2

How can I bold my output like this

Student "John" assigned to Officer "Mick".

i want John and Mick bold in web

This is my code aspx :

this.lblAssignee.Text = " Student \"" + StudentAssign + "\" assigned to Officer \"" + objAssign.FullName + "\".";

Chris Herring
  • 3,675
  • 3
  • 33
  • 50
user1545307
  • 21
  • 1
  • 1
  • 3
  • Possable duplicate post [here](http://stackoverflow.com/questions/6403902/making-specific-text-bolded-in-a-textbox) – Gunnar Jul 23 '12 at 08:37

2 Answers2

4

Try this

this.lblAssignee.Text = " Student \"<b>" + StudentAssign + "</b>\" assigned to Officer \"<b>" + objAssign.FullName + "</b>\".";

or this (better maintainability)

this.lblAssignee.Text = " Student \"<span class='highlight'>" + StudentAssign + "</span>\" assigned to Officer \"<span class='highlight'>" + objAssign.FullName + "</span>\".";

and in your stylesheet

.highlight { font-weight: bold; }
Chris Herring
  • 3,675
  • 3
  • 33
  • 50
2

Another option would be setting the Font.Bold property of the label to True.

Something like:

myLabel.Font.Bold = True

Assuming you can use several labels of course.

Joseph L.
  • 431
  • 6
  • 7