gridview如何将超长字符串自动截断,然后用省略号代替吗?知道的话把详细的步骤说明一下,谢谢

2024-12-27 13:16:26
推荐回答(1个)
回答1:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
e.Row.Cells[0].Text = e.Row.Cells[0].Text.Length >10 ? "大于10" : "小于10";
}