这是我现在的效果
如何让gridview中单元格中过长的内容用省略号表示???鼠标放上时可以全部显示?
这是我百度的代码块
protected void SGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)//数据行
{
string Str = e.Row.Cells[1].Text; //第二列内容
if (Str.Length > 0) //第二列内容大于20个
{
e.Row.Cells[1].Text = Str.Substring(0, Str.Length) + "..."; //截取20个显示,其他用“...”号代替
e.Row.Cells[1].ToolTip = Str;//鼠标放上去显示全部信息
}
}
}
就有什么问题嘛 各位大佬