开发者

Constraints of text that is showing in asp.net Label's

开发者 https://www.devze.com 2023-01-21 15:49 出处:网络
everyone! Could someone tall me how I can limit count of line of text, that is showing in asp.net Labe开发者_JAVA技巧l control?

everyone! Could someone tall me how I can limit count of line of text, that is showing in asp.net Labe开发者_JAVA技巧l control? Thanks!


You could use this css to define a max width for the cell(or the outer container). To define a max length of the text, you have to truncate the text to your maximum length by yourself.

.longtext td{ width:100px;word-wrap : break-word ;word-break : normal; }
<asp:Label ID="lblText" runat="server" CssClass="longtext">

lblText.Text=lblText.substring(0,yourMaxLength)


Make changes .css

.limitWidth {

    white-space: nowrap;     
    max-width: 100px;
    text-overflow: ellipsis;
    overflow-x: hidden;

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号