0

I want to add a rows to my datagridview after its fetch the data from the database. For example :

Product - - - Price
   1    - - - 100
   2    - - - 100
   3    - - - 100
 Total  - - - 300

The Total is the value I would add manually. Any help thanks in advance.

ROM
  • 227
  • 2
  • 5
  • 11
  • This may help: http://stackoverflow.com/questions/10063770/c-sharp-how-to-add-a-new-row-to-datagridview-programmatically – Rubixus Aug 05 '13 at 17:58

1 Answers1

2

Add a label for sum in your FooterTemplate

and on server side in rowdatabound event,

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

     if (e.Row.RowType == DataControlRowType.Footer)
    {
   //Do your code
    }
    }
Rahul
  • 428
  • 1
  • 5
  • 11