How can I dynamically add a row in datagridview
in c#. Sum of cell and print total answer in the last row?
Asked
Active
Viewed 55 times
0

Martin Evans
- 45,791
- 17
- 81
- 97

patel chirantan
- 1
- 2
-
1can you please elaborate ? – meet thakkar Mar 19 '16 at 08:00
-
Please take a look at this? [add row to datagridview](http://stackoverflow.com/questions/10063770/how-to-add-a-new-row-to-datagridview-programmatically); maybe post some of your code? – Dave Wijnen Mar 19 '16 at 08:07
1 Answers
0
You want a footer row if I am correct. You must add a
<FooterTemplate> </FooterTemplate>
in your data grid. Then you can use it in RowCreated, Page Unload events (or where you need) to modify contents and display desired data.
You could use RowCreated event as :
protected void MyGrid_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{
//e.Row.FindControl("what ever control i have");
//use the control to modify content
}
}

TSungur
- 396
- 2
- 9