加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 如何在网格视图列标题上添加鼠标悬停工具提示

发布时间:2020-12-16 04:21:03 所属栏目:asp.Net 来源:网络整理
导读:当用户将鼠标悬停在gridview中列的列标题上时,例如:列标题年,当我将鼠标悬停在年份上时,我应该看到该年份的含义的解释“这是学生加入大学等的年份”. 下面是我的ascx代码: asp:GridView ID="grdView" runat="server" Width="900px" AutoGenerateColumns="F
当用户将鼠标悬停在gridview中列的列标题上时,例如:列标题年,当我将鼠标悬停在年份上时,我应该看到该年份的含义的解释“这是学生加入大学等的年份”.

下面是我的ascx代码:

<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列标题上的文本或工具提示上.
谢谢,

解决方法

我从来没有做过任何asp.net开发,但这里似乎提供了一个解决方案: how to add title for every header column in gridview in ASP.NET

你的样本看起来像这样:

<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>

我试试看:)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读