当gridview单元格显示的值过长,想做一个效果是鼠标移上去用一个div显示它的详细信息,怎么解决?

解决方案 »

  1.   

    假设20个字符是合适的长度,而你要显示的是200个字符的东西。
    那你可以在第一个单元格显示前20个字符,把200个字符放在第N格里,然后在RowCreated事件里隐藏第N列。
    protected void GV_Contents_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType.Equals(DataControlRowType.Header) || e.Row.RowType.Equals(DataControlRowType.DataRow))
            {
                
                e.Row.Cells[n-1].Visible = false;
            }
        }其它的工作就是脚本的事情了吧:)
      

  2.   

    设置title
    onmousemove弹出DIV显示详细信息
    e.Row.Cells[1].Attributes.Add("onmouseover", "");
      

  3.   

    protected void GV_Contents_RowCreated(object sender, GridViewRowEventArgs e)
      {
    e.Row.Cells[1].Attributes.Add("onmouseover", "");
      }
      }
      

  4.   


    <asp:Label runat="server" id="lblname" text='<%#Eval("Name")%>' toolTip='<%#Eval("Name")%>'></asp:Label>
    text那里自己截取长度!