Sum column in GridView

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm using this function to sum the values of a column in a grid view and
it's working fine but the only problem that is summing only the displayed
page of my grid so if I go to the next page it will calculate only sum of the
values of the column in that page

public void sumRows(Object src, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TableCellCollection cells = e.Row.Cells;
// assumes column to sum is last column in grid
total += float.Parse(cells[4].Text);
cells[4].Text = string.Format("{0:n}",
float.Parse(cells[4].Text));

}
}
 
Badis,

In the dotnet newsgroup we don't like it if somebody is asking almost the
same question in diffferent threads in almost less than an hour. Have a look
at your follow up question, where I have given an answer on your follow up.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top