鼠标悬停时如何在gridview行中显示工具提示文本? [英] How to show tooltip text in gridview row on mouseover?

查看:98
本文介绍了鼠标悬停时如何在gridview行中显示工具提示文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在鼠标悬停时在gridview行中显示工具提示文本?

How to show tooltip text in gridview row on mouseover?

推荐答案

您需要为此使用GridView的 RowDataBound .
You need to use RowDataBound of GridView for this.
protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{  
   DataControlRowType rtype = e.Row.RowType;   
   if (rtype == DataControlRowType.DataRow && rtype != DataControlRowType.Footer 
       && rtype != DataControlRowType.Separator && rtype != DataControlRowType.Header 
       && rtype != DataControlRowType.Pager)   
   {  
      //Highlight Row    
      //e.Row.Attributes.Add("onmouseover", "Highlight(this,'#DCEDFF');");
      //ShowToolTip
      e.Row.ToolTip = "This text needs to shown on mouseover of the row!";
   }
}


<asp:menu id="Menu1" runat="server" backcolor="#F7F6F3" xmlns:asp="#unknown">
           DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
           ForeColor="#7C6F57" StaticSubMenuIndent="10px"
           style="z-index: 1; left: 78px; top: 85px; position: absolute; height: 34px; width: 78px">
           <staticselectedstyle backcolor="#5D7B9D" />
           <staticmenuitemstyle horizontalpadding="5px" verticalpadding="2px" />
           <dynamichoverstyle backcolor="#7C6F57" forecolor="White" />
           <dynamicmenustyle backcolor="#F7F6F3" />
           <dynamicselectedstyle backcolor="#5D7B9D" />
           <dynamicmenuitemstyle horizontalpadding="5px" verticalpadding="2px" />
           <statichoverstyle backcolor="#7C6F57" forecolor="White" />
           <items>
               <%--<asp:menuitem popoutimageurl="~/IMAGES/Chrysanthemum.jpg" text="HOME" value="0">
                   <asp:menuitem navigateurl="~/Default2.aspx">
                       PopOutImageUrl="~/IMAGES/Chrysanthemum.jpg" Text="ABOUT US" Value="1">
                   </asp:menuitem>
                   <asp:menuitem text="CAREERS" value="2"></asp:menuitem>
               </asp:menuitem>--%>
               <asp:menuitem text="CLIENTS" value="4"></asp:menuitem>
           </items>
       </asp:menu>


有关特定列上自定义工具提示的信息,请单击以下文章.
http://www.dotnettwitter.com/2010/11/showing- tooltip-with-some-data-from.html [ ^ ]
For custom tooltip on a particular column for each row on mouse over of gridview row, you can refer the following post.

http://www.dotnettwitter.com/2010/11/showing-tooltip-with-some-data-from.html[^]


这篇关于鼠标悬停时如何在gridview行中显示工具提示文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆