views:

368

answers:

1

I am having 2 datatables. One is having the actual value of that table selected by the user and the next is having the aggregate value for that table i.e any grand total or avg. I want to display this as the footer in C# datagridview. How can I do that??? In asp.net we have RowDataBound event like that similar something is there in C# also but what it is i'm not able to find.

A: 

You can use ondatabound event of GridView for populating footer. Sample:

protected void GridView1_DataBound(object sender, EventArgs e)
{
    GridView grid = sender as GridView;

    grid.FooterRow.Cells[0].Text = CustomDataSource.GetAggregated.Rows[0]["Name"].ToString();
    grid.FooterRow.Cells[1].Text = CustomDataSource.GetAggregated.Rows[0]["Total"].ToString();
}
iburlakov
Hmmm is there DataBound event available for DataGridView in windowsForm????
Jankhana