2010-02-24 39 views
0

早上全部。增加gridview标题工具提示显示时间

我有一个gridview使用字典来显示工具提示对所述gridview中的标题。

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
     { 
      Dictionary<String, String> headerTooltips = new Dictionary<String, String>(); 


      headerTooltips["Product ID"] = "product identification code"; 
      headerTooltips["Product Description"] = "description of the product"; 

     { 
       if (e.Row.RowType == DataControlRowType.Header) 
        { 
         foreach (TableCell cell in e.Row.Cells) 
          { 
           foreach (System.Web.UI.Control ctl in cell.Controls) 
            { 
             if (ctl.GetType().ToString().Contains("DataControlLinkButton")) 
              { 
               string headerText = ((LinkButton)ctl).Text; 
               cell.Attributes.Add("title", headerTooltips[headerText]); 

              } 

            } 
          } 
        } 
      } 

     } 

这很好,工作很漂亮...超级。

但是,一些工具提示花费的时间超过了默认的5000ms,有谁知道我可以用我目前使用的代码以编程方式延长显示时间吗?

感激地收到任何帮助。

+0

你是否使用秒表进行时间测试?也许GetType越来越慢你的代码和字典中有多少元素?否则我认为你什么都做不了。 – cem

回答

0

这是一个浏览器设置,你不能改变它。 工具提示在浏览器中作为元素标记的标题参数呈现,并且您无法在该点控制浏览器。 您可以使用MoseOver和MouseOut事件调用一个自制javascript函数,在您的元素附近显示浮动潜水,将元素引用传递给js函数。

+0

我不确定工具提示是否是浏览器设置或不是..感谢您清除它。 正如你所说,我会使用javascript和mouseover方法。感谢您的意见。 –