Hello frdz, I have a field of amount.I want to make the summary total of that amount field.I have theAmount fieldTotal Exp5066.75-----------116.75I m not getting error with the below code but i m not getting at all a output of total in the footer in grid-view... <asp:GridView ID="MiscPayGridView" runat="server" ShowFooter="True"> <asp:TemplateField HeaderText=" Total Expenses"> <ItemTemplate> <%# Eval("totalexp", "{0:c}")%> </ItemTemplate> <FooterTemplate> <asp:Label ID="lblSummary" runat="server" /> </FooterTemplate> </asp:TemplateField>
private decimal _TotalExpTotal = 0; protected void MiscPayGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { decimal TotalExps = (decimal)DataBinder.Eval(e.Row.DataItem, "totalexp"); _TotalExpTotal += TotalExps; } if (e.Row.RowType == DataControlRowType.Footer) { Label lblSummary = (Label)e.Row.FindControl("lblSummary"); lblSummary.Text = String.Format("Total Exp: {0:c}", _TotalExpTotal); } }
How to take that total in the footer of gridview ?Can anyone tell me where i m wrong...http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=84639thanxss......