I am using a website which contains a gridview for view details of Product details… It contains columns like name,area,phnoe no,quantity,price,total…. now I want to calculate total value for that I have to multiply the columns quantity and Price and also put that answer to total column in grid… How shall I do this?
Share
There are three(may be more) ways to accomplish this.
First is query database and show result on grid
To do this : Query like
select name,area,phone,quantity,price,quantity * price as Total from YOUR_TABLE
Then bind it into your datagrid
Second is before binding your source which is here datatable into the grid,loop for this table for your sum.
To do this: You have datatable but not you have column named Total this time.
Now you need to add a new column as Total into the datatable.
All we have done above is generating a computed column
Third,use javascript for cells to assemble your specific values to sum,but this time you need to find your datagrid then your cells in which you should prefer using a javascript framework like jquery.I do not know any reference point for this,but First and second options will be much easier to do
Best Regards
Myra