How to display the part of a string underlined by an asp.net label control?

I have an asp label control used to display error messages to the user. My client would like to underline some words in these messages. How will this be achieved?

Thanks James

+2


source to share


4 answers


Simplified version of David Andres' solution:



Label.Text = "this is an <u>underlined expression</u>";

      

+7


source


Although a bit hacky, you can assign HTML markup to the Label Text property. Something like this should be sufficient:

Label.Text = "this is an <span class='underlineIt'>underlined expression</span>";

      



This class assigns the underlineIt

words "underlined expression" to the class . Within the underlineIt CSS class, you can set a rule text-decoration: underline

.

+1


source


I totally didn't understand the blah question.

Paste HTML into the shortcut text property.

0


source


The content of a literal control is not html encoded, so you can replace the control with a label and then insert tags around the words you want to underline.

<asp:Literal ID="lblTitle" runat="server" Text='my <u>underlined</u> text' />

      

0


source







All Articles