如何在“网格视图"列标题上的鼠标悬停时添加工具提示 [英] How to add a tooltip on mouse over on the Grid View Column Heading

查看:104
本文介绍了如何在“网格视图"列标题上的鼠标悬停时添加工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户将鼠标悬停在gridview中某个列的列标题上时,例如:列标题 Year ,当我将鼠标悬停在Year上时,应该看到对该Year含义的解释:这是年份学生何时加入大学等.

When the user hover overs the column heading of a column in gridview for eg: Column Heading Year, when I hover over Year I should see an explanation of what that Year means "This is the year when the student joined the college etc".

下面是我的ascx代码:

Below is my ascx code:

 <asp:GridView ID="grdView" runat="server" Width="900px" AutoGenerateColumns="False"
                AllowPaging="true" AllowSorting="true" CellSpacing="0" CellPadding="5" PageSize="20"
        OnRowDataBound="grdView_RowDataBound">
                <Columns>
 <asp:TemplateField HeaderText="ID Number" ItemStyle-Width="90px" >
    <ItemTemplate>
      <asp:Label ID="Label1" runat="server" Text='<%# Bind("ID")%'></asp:Label>
    </ItemTemplate>
 </asp:TemplateField><asp:BoundField DataField="StudentName" HeaderText="StudentName"> </asp:BoundField>

请让我知道如何将鼠标悬停在gridview列标题上的文本或工具提示上. 谢谢,

Please let me know how could I have hover over texts or tooltips on column headings of my gridview. Thanks,

推荐答案

我从来没有做过asp.net开发,但是这里似乎提供了一个解决方案:

I've never done any asp.net development, but there seems to be a solution provided here: how to add title for every header column in gridview in ASP.NET

您的样本可能如下所示:

your sample could look like this:

 <asp:GridView ID="grdView" runat="server" Width="900px" AutoGenerateColumns="False"
            AllowPaging="true" AllowSorting="true" CellSpacing="0" CellPadding="5" PageSize="20"
    OnRowDataBound="grdView_RowDataBound">
            <Columns>
 <asp:TemplateField HeaderText="ID Number" ItemStyle-Width="90px" >
<HeaderTemplate>
       <asp:Label ID="Header" ToolTip="HERE WE GO!!!!" runat="server" Text="Label"></asp:Label>
       </HeaderTemplate>
    <ItemTemplate>
      <asp:Label ID="Label1" runat="server" Text='<%# Bind("ID")%'></asp:Label>
    </ItemTemplate>
 </asp:TemplateField><asp:BoundField DataField="StudentName" HeaderText="StudentName"> </asp:BoundField>

我会试一试:)

这篇关于如何在“网格视图"列标题上的鼠标悬停时添加工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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