Reputation: 305
I have an asp Label control used for displaying error messages to the user. My client would like certain words in these messages to be underlined. How would this be accomplished?
Thank you, James
Upvotes: 2
Views: 15441
Reputation: 1
This is the best way and sample code.
<asp:Label ID="Label88" runat="server" Font-Underline="true" Font-Bold="true" Text="RESULT"></asp:Label>
Upvotes: 0
Reputation: 48088
Simpler version of David Andres's solution :
Label.Text = "this is an <u>underlined expression</u>";
Upvotes: 9
Reputation: 28141
The contents of a literal control are not html encoded so you could swap out the label control then insert tags around the words you want underlined.
<asp:Literal ID="lblTitle" runat="server" Text='my <u>underlined</u> text' />
Upvotes: 0
Reputation: 31801
Though a bit hacky, you can assign HTML markup to the Label's Text property. Something like this should suffice:
Label.Text = "this is an <span class='underlineIt'>underlined expression</span>";
The would assign class underlineIt
to the words "underlined expression." Within the underlineIt CSS class, you can set the rule text-decoration: underline
.
Upvotes: 2
Reputation: 24606
I total misunderstood the question blah.
Embed the HTML into the label's text property.
Upvotes: 0