当用户将鼠标悬停在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>
解决方法
我从来没有做过任何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>
我试试看:)