public string FormatTitleLength(string s)
{
return s.Length>20 ? s.SubString(0,20)+"..." : s;
}
在帮定的时候用模版列
<asp:TemplateColumn>
<ItemStyle Font-Names="宋体" HorizontalAlign="Left" Width="420px"></ItemStyle>
<ItemTemplate>
<%# FormatTitleLength(DataBinder.Eval Container, "DataItem.article_title").ToString())%>
</ItemTemplate>
</asp:TemplateColumn>