TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rajkumar R
NA
183
219.7k
Grid view footer total in asp.net
Nov 4 2011 2:51 AM
protected void inderGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
decimal grdtotal1 = 0; // This is global variable i declared in class
if (e.Row.RowType == DataControlRowType.DataRow)
{
decimal rowTotal = Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "DC_No_Decimal"));
if (e.Row.DataItemIndex >= inderGrid.PageIndex * inderGrid.PageSize && e.Row.DataItemIndex < inderGrid.PageIndex * inderGrid.PageSize + inderGrid.PageSize)
{
grdTotal = grdTotal + rowTotal;
grdtotal1 = grdTotal;
}
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "Totals:";
// for the Footer, display the running totals
e.Row.Cells[3].Text = grdTotal.ToString("c");
// e.Row.Cells[2].Text = quantityTotal.ToString("d");
e.Row.Cells[1].HorizontalAlign = e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Right;
e.Row.Font.Bold = true;
}
}
The above code display total in every page of the gridview. I need total at the end of the grid. My grid contain 20 pages , from that 20 page i want to display the total in the 20th page by adding all of the pages. Please help me its urgent
Attachment:
sample1.zip
Reply
Answers (
5
)
How to zip and unzip files using C#
Add new row to the gridview