我想设置某一列下面的脚模版
前台
<asp:TemplateField HeaderText="投资收益(元)">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("money") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lbltotal" runat="server" Text=""></asp:Label>
</FooterTemplate>
</asp:TemplateField>
后台
if (e.Row.RowType == DataControlRowType.Footer)
{
((Label)e.Row.FindControl("lbltotal")).Text ="总计:"+ it.ToString();
}但是这样 脚模版 怎么显示不出来 有谁知道怎么样显示吗?
前台
<asp:TemplateField HeaderText="投资收益(元)">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("money") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lbltotal" runat="server" Text=""></asp:Label>
</FooterTemplate>
</asp:TemplateField>
后台
if (e.Row.RowType == DataControlRowType.Footer)
{
((Label)e.Row.FindControl("lbltotal")).Text ="总计:"+ it.ToString();
}但是这样 脚模版 怎么显示不出来 有谁知道怎么样显示吗?
ShowFooter="True"
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
{
sum+= Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Price"));
}
else if(e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[3].Text="合计:";
e.Row.Cells[4].Text =sum.ToString();
}
if (e.Row.RowType == DataControlRowType.DataRow) {
sum+= Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Price"));
} else if(e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[3].Text="合计:"; e.Row.Cells[4].Text =sum.ToString(); }
你改成true