【发布时间】:2013-12-13 18:32:07
【问题描述】:
我有一个gridView:-
<asp:GridView ID="gvwAccums" runat="server"
AutoGenerateColumns="false"
CssClass="GridView"
HeaderStyle-CssClass="GridViewHeaderRowStyle"
RowStyle-CssClass="GridViewRowStyle"
AlternatingRowStyle-CssClass="GridViewAlternatingRowStyle"
EmptyDataRowStyle-CssClass="GridEmptyDataRowStyle"
>
<Columns>
<asp:BoundField HeaderText="Start Date" DataField="Beg_PlanYr" />
<asp:BoundField HeaderText="Paid" DataField="indTotPaid" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right"
ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Copay" DataField="indTotCopay" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right"
ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Deductible" DataField="indTotDed" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right"
ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Out of Pocket" DataField="indTotOop" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right"
ItemStyle-HorizontalAlign="Right" />
</Columns>
<EmptyDataTemplate>
<div id="pnlEmptyAcums" runat="server" class="NoRecs">
<span style="font-style: italic">No Accumulated Totals found.</span>
</div>
</EmptyDataTemplate>
</asp:GridView>
我正在尝试将定义文本添加到服务器端的列标题中:-
protected void gvwAccums_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
bool isDataRow = row.RowType == DataControlRowType.DataRow;
TableCellCollection cells = e.Row.Cells;
string allCells = string.Empty;
string content = "";
int lastCol = cells.Count - 1;
content = cells[lastCol].Text.Trim();
// Only do this to the header row, ignore data and footer rows. Adding definition to the label of each column on the Gridview of claims.
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].ToolTip = "xxxxx ";
e.Row.Cells[1].ToolTip = "yyyyy ";
e.Row.Cells[2].ToolTip = "zzzzz ";
e.Row.Cells[3].ToolTip = "fffff ";
e.Row.Cells[4].ToolTip = "vvvvv ";
}
}
但是,当我将鼠标指针悬停在上面时,我看不到任何文字。网格视图本身工作正常。
谁能帮忙?
【问题讨论】:
标签: c# javascript html asp.net gridview