您的位置:首页 > 其它

GridView的单元格在内容显示超过长度的时候用省略号 ......

2012-08-31 15:26 211 查看
From: http://blog.csdn.net/single_killer/article/details/7101901

最简单的可以通过CSS来设置省略号,

鼠标移上全部显示用ToolTip,

1.CSS:

<style type="text/css">

.mlength

{

display: block;

width: 100px;

overflow: hidden;

white-space: nowrap;

-o-text-overflow: ellipsis;

text-overflow: ellipsis;

}

</style>

2.设置GeidView某一字段为模板列并设置css,如:

<asp:Label ID="Label1" runat="server"title='<%#
Eval("字段") %>'Text='<%# Eval("字段") %>' CssClass="mlength"></asp:Label>

注意:<td>等块中IE可能不能截断,可外面套层<div>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐