GridView字段+...

1.可以在绑定事件里
if(e.Row.Cells[0].Text.Length>50) e.Row.Cells[0].Text = e.Row.Cells[0].Text.SubString(0,50) + "..."

2.也可以在前台页面中绑定写如下:
<asp:Label ID="Label1" runat="server" Text='<%# (Eval("商品简介字段").ToString().Length>50)?Eval("商品简介字段").ToString().Substring(0,50)+"...":Eval("商品简介字段").ToString() %>'></asp:Label>

posted @ 2017-03-22 15:03  SkyLeo  阅读(134)  评论(0编辑  收藏  举报