grid footer summary

  • Thread starter Thread starter Sharon Tal
  • Start date Start date
S

Sharon Tal

Hi to all.
I need to make a grid that sums up columns at the footer.
I have 2 data views one for the grid and one for the summary.
From what i read, i understand that it's not easy to do with the data grid
web control.
So i'm looking for a better way.
Thanks.
 
You can do just about whatever you want in the itemcreated event for the
footer or pager.
 
Hi Rick.
Thanks for the idea, it works and its simple.

void Item_Created(Object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Footer)
{
IEnumerator cellEnum = e.Item.Cells.GetEnumerator();

while(cellEnum.MoveNext())
{
TableCell tc = (TableCell)cellEnum.Current;
tc.Text = "some value";
}
}
}
 
If you want to be sure what column you're working with, I would make the
column a template column, and put a label (or other control of your
choosing) into the footer template. Then, you can find it by ID with
..findcontrol . This also helps if you decide to rearrange your columns, as
you won't be dependent on the ordering!
 
Back
Top