Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make label multiline

Tags:

c#

asp.net

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

like image 986
Jake Avatar asked May 21 '13 04:05

Jake


People also ask

Can label be multiline?

Property Value True if the label control is multiline; otherwise, False. A multi-line label control renders the label's text on more than one line. If the WordWrap property is set to True, long lines will be wrapped to the following line.

How do you label multiple lines in C#?

We can also use a Panel control to create a multiline label in C#. We can place the desired label inside a panel and then handle the ClientSizeChanged event for the panel. The ClientSizeChanged event is invoked whenever the size of a control inside the panel changes. We can resize the label with the Label.

How do you wrap labels in VB net?

Set Property "WordWrap = True" for Label control, it will wrap to the nextline for the new word . It will not cut the word in between, unless the word length is bigger than the physical length of the Label..


1 Answers

<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

like image 124
shreyash gajbhiye Avatar answered Nov 10 '22 07:11

shreyash gajbhiye