C# 识别行内数据绑定事件中的单元格列标题名称
我需要使用工具提示显示单元格的说明。我需要使用OnRowDataBound标识单元格的标题C# 识别行内数据绑定事件中的单元格列标题名称,c#,asp.net,gridview,C#,Asp.net,Gridview,我需要使用工具提示显示单元格的说明。我需要使用OnRowDataBound标识单元格的标题 <asp:GridView ID="grdOne" runat="server" AutoGenerateColumns="False" CssClass="common_tbl full_width" AllowPaging="true" OnPageIndexChanging="grdOne_PageIndexChanging" OnRowDataBound="grdOne_OnRowDat
<asp:GridView ID="grdOne" runat="server" AutoGenerateColumns="False" CssClass="common_tbl full_width" AllowPaging="true"
OnPageIndexChanging="grdOne_PageIndexChanging" OnRowDataBound="grdOne_OnRowDataBound">
<Columns>
<asp:TemplateField HeaderText="Bank Code">
<ItemTemplate>
<asp:Label ID="lblBankCode" runat="server" Text='<%#Eval("BankCode")%>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Branch Code">
<ItemTemplate>
<asp:Label ID="lblBranchCode" runat="server" Text='<%#Eval("BranchCode")%>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void grdOne_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
}
受保护的void grdOne_OnRowDataBound(对象发送方,GridViewRowEventArgs e)
{
}
希望这能奏效
protected void grdOne_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.ToolTip = "Description";
}
}
或
鼠标指针位于单元格上时,要在何处显示工具提示
protected void grdOne_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("title", "Description");
}
}