Hi,
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
Hi,
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
I total misunderstood the question blah.
Embed the HTML into the label's text property.
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
.
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' />