开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜