关于aspxgridview里面过长内容只显示的一部分的处理方案

 1   protected void g_Message_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e)
 2         {
 3             if (e.Column.FieldName == "字段")
 4             {
 5                 if (e.Value != null)
 6                 {
 7                     string cellValue = e.Value.ToString();
 8                     if (cellValue.Length > TextMaxLength)
 9                         e.DisplayText = cellValue.Substring(0, TextMaxLength) + "...";
10                 }
11             }
12         }
13 
14         protected void g_Message_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
15         {
16             if(e.DataColumn.FieldName == "字段")
17             if(e.CellValue != null)
18                 e.Cell.ToolTip = e.CellValue.ToString();
19          }

 

posted @ 2014-05-22 11:59  南修子  阅读(626)  评论(0编辑  收藏  举报