how to calculate total in the gridview
-
hi iam using asp.net with c# in my gridview 1st column is checkbox select productname price quantity total () rose 124 6 124*6 () biscuits 345 89 345*89 () choclate 670 45 670*45 ======= 67000 ======== when user enters quantity automatically in total colum total is displayed please can you give some example for this ...
-
hi iam using asp.net with c# in my gridview 1st column is checkbox select productname price quantity total () rose 124 6 124*6 () biscuits 345 89 345*89 () choclate 670 45 670*45 ======= 67000 ======== when user enters quantity automatically in total colum total is displayed please can you give some example for this ...
Uhm.. maybe you can calculate the Total in advanced before you databind to the Grid View. Or you can use a nested foreach loop for each row and cell and extract the value then do the calculations and assign that in the Total Column.
-
hi iam using asp.net with c# in my gridview 1st column is checkbox select productname price quantity total () rose 124 6 124*6 () biscuits 345 89 345*89 () choclate 670 45 670*45 ======= 67000 ======== when user enters quantity automatically in total colum total is displayed please can you give some example for this ...
You could do it on the client-side with jQuery and save a lot of server-side processing and roundtrips. It would be easy to attach an event listener to the checkbox and total all the item's subtotals, etc. Here is a link to an example that updates the total the items in the order table as you add and remove items. It doesn't use Web Forms, but just as easily could: Interactive Form Functionality on the Client-Side Using jQuery[^]. There is a working example at http://altweb.lazerinc.com/jquery/order_dev.htm[^].
Regards, Gary
modified on Monday, April 5, 2010 9:09 AM