且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使标签多行

更新时间:2023-12-04 12:57:04

 < ASP:标签
    ID =myLabel
    =服务器
    风格=自动换行:打破字;
    WIDTH =140px
    文本=这是我的标签等等...去此处< A HREF ='Destn.aspx'>此处< / A>至更新/>

添加width属性,并提供任何你想要的任何适当的值,并添加一个CSS样式,这将包裹字

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

<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