Jake
Jake

Reputation: 1332

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

Upvotes: 8

Views: 27801

Answers (3)

shreyash gajbhiye
shreyash gajbhiye

Reputation: 190

<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

Upvotes: 8

Pankaj Agarwal
Pankaj Agarwal

Reputation: 11309

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

Upvotes: 0

Habib
Habib

Reputation: 223422

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).

Upvotes: 7

Related Questions