我在网上搜索到大多数人认可的代码,可是的我应用时却无法实现。
CSS代码
</style>
<style type="text/css">
.mlength
{
display: block;
width: 180px;
overflow: hidden;
white-space: nowrap;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
}
设置GridView的某一字段为模板列并设置css与设置ToolTip
<asp:Label ID="Label1" runat="server" Text='<%# Eval("字段") %>' CssClass="mlength" ToolTip='<%# Eval("字段") %>'></asp:Label>
不懂为什么实现不了?
https://blog.csdn.net/cuixiping/article/details/6739692
浏览器兼容性
还有就是检查下text-overflow: ellipsis;在浏览器里应用了没有,换言之,css样式表是不是没有加载