Make label multiline

I know the easy solution would be to make the label a textbox with multiline but this does not solve the problem since I want to render anchor tags inside the text value. For example:

 <asp:Label ID='myLabel' runat="server" Text=" This is my label etc... go 
here  <a href='Destn.aspx'>Here</a> to update" />

This can’t be done by using a textbox since a textbox will not display the anchor tag as a link instead it will display as plain text

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

<asp:Label 
    ID='myLabel' 
    runat="server"  
    style="word-wrap:break-word;" 
    Width="140px" 
    Text=" This is my label etc... go here <a href='Destn.aspx'>Here</a> to update" />

Add width property and provide any appropriate value whatever you want and add one css style which will wrap the word

Method 2

Use <br/> in your TEXT to create new row in label text.

<asp:Label ID='myLabel' 
       runat="server" 
       Text=" This is my label etc... go <br /> here  
       <a href='Destn.aspx'>Here</a> to update" />

See: <br> – MDN

The HTML <br> Element (or HTML Line Break Element) produces a line
break in text (carriage-return).

Method 3

Select the dropdown next to the label. Then Press Ctrl + Enter key for Line – break

Edit

It work only when page open in Design Mode


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x