/// <summary>
/// 修复单元格中字符串过长的问题
/// 同时给单元格添加鼠标悬停事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string tx= e.Row.Cells[8].Text;
e.Row.Cells[8].ToolTip = tx;
if (tx.Length > 10)
{
tx = tx.Substring(0, 10) + "......";
}
e.Row.Cells[8].Text = tx;
}
/// 修复单元格中字符串过长的问题
/// 同时给单元格添加鼠标悬停事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string tx= e.Row.Cells[8].Text;
e.Row.Cells[8].ToolTip = tx;
if (tx.Length > 10)
{
tx = tx.Substring(0, 10) + "......";
}
e.Row.Cells[8].Text = tx;
}
本文介绍了如何在GridView组件中处理字符串过长问题,并为单元格添加鼠标悬停事件,优化用户体验。
1060

被折叠的 条评论
为什么被折叠?



