zoukankan      html  css  js  c++  java
  • GridView1_RowDataBound解决限制字段显示长度用"..."显示ToolTip

    ToolTip:

    //
    // 摘要:
    // 获取或设置当鼠标指针悬停在 Web 服务器控件上时显示的文本。
    //
    // 返回结果:
    // 当鼠标指针悬停在 Web 服务器控件上时显示的文本。默认值为 System.String.Empty。

    protected void gvMain_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string url = e.Row.Cells[5].Text.Trim();
                    if (url.length>20)
                    {
                        e.Row.Cells[5].ToolTip = url;
                        e.Row.Cells[5].Text = url.substring(0,20)+"...";
                    }
             }
            
        }

  • 相关阅读:
    PHP入门03 -- 数组与数据结构
    PHP入门02 -- 函数
    PHP入门01 -- 基本语法
    node文章
    Mongodb08
    Mongodb07
    ISO处理jq事件
    map
    Django自定义模板
    JS this指向
  • 原文地址:https://www.cnblogs.com/liouxing199/p/5264995.html
Copyright © 2011-2022 走看看