• 鼠标移动到gridVIew某列中显示此列的详细内容


    在gridView列表中,有的时候某列中的内容过多,我们只显示之前的部分,查看详细后才能知道全部内容,

    这几天有个需求:鼠标移动到此列需要显示全部信息,方法如下:

     //如果说明字数过多则显示概要
        protected void gvInitAcceptList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[3].Text.Length > 40)
                {
                    e.Row.Cells[3].Text = e.Row.Cells[3].Text.Substring(0, 40) + "...";
                }
            }
        } 

    //鼠标指到此列时会显示此列的详细信息

    protected void gvSpot_RowDataBound(object sender, GridViewRowEventArgs e)
        {
             if (e.Row.RowType == DataControlRowType.DataRow)
            {

               string note = e.Row.Cells[12].Text.ToString();
                if (note != "" && note != " ")
                {
                    //鼠标移到此列 显示此列的信息

                    e.Row.Cells[12].ToolTip = note;
                    e.Row.Cells[12].Attributes["style"] = "Cursor:hand";
                }
            }
        }

  • 相关阅读:
    头文件<stdarg.h>
    头文件<signal.h>
    头文件<setjmp.h>
    头文件<math.h>
    头文件<locale.h>
    头文件<limits.h>
    头文件<ctype.h>
    头文件<assert.h>
    PHP error_reporting
    八大排序算法
  • 原文地址:https://www.cnblogs.com/qq1040991197/p/2788994.html
Copyright © 2020-2023  润新知