Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear friend I have one gridview and one checkboxlist cheboxlist conatin

following Items
Apr-15
May-15
Jun-15
Jul-15
Aug-15
Sep-15
Oct-15
Nov-15
Dec-15
Jan-15
Feb-15
Mar-15


my gridview also have same column as item name like
Apr-15 May-15 Jun-15 Jul-15 Aug-15 Sep-15 Oct-15 Nov-15 Dec-15 Jan-15 Feb-15 Mar-15


and these column contains integer type value as
Apr-15 May-15 Jun-15 Jul-15 Aug-15 Sep-15 Oct-15 Nov-15 Dec-15 Jan-15 Feb-15 Mar-15
500     0       0      0     0      0      0     0      0       0      0     0
1500    0       0      0     0      0      0     0      0       0      0     0
350     0       0      0     0      0      0     0      0       0      0     0
400    500      500    500   500    500    500   500    500     500    500   500


now i want to calculate the running total of column value in gridview means if i select two Items from cheboxlist like Apr-15,May-15 then my code can calculate only running total of two column in gridview for Apr-15,May-15 if I select three item from cheboxlist like Apr-15,May-15,Jun-15 my code can calculate only running total of three column in gridview for Apr-15,May-15,Jun -15. and so on...
please any one suggest us or give some idea how we can do this
Posted
Updated 28-Nov-15 5:22am
v2
Comments
George Jonsson 28-Nov-15 23:23pm    
Can you give an example of the calculation with real numbers and the expected result?
It is not totally clear what it is you want to do.
jitendra raj 30-Nov-15 5:43am    
yes if we select Apr-15,May-15 from chekboxlist then my code can calculate the running total like as

for column Apr-15
500
1500
350
400
Running Total 2750
and for column May-15
0
0
0
500
running total is 500

1 solution

The running total can be achieved in couple of ways.

It depends on how you want it Server side or Client side.

Both can be reffered in the following link, you may get a fair idea on how to implement it.

Running Cumulative total in gridview column

Calculate running total in ASPNet GridView using jQuery
 
Share this answer
 
Comments
jitendra raj 30-Nov-15 5:32am    
No I think I clearly not understand my question please I want to calculate the running total of perticular column if we select two items from cheboxlist like Apr-15,May-15 then calculate running total of two column Apr-15,May-15 in gridview if we select Apr-15,May-15,Jun-15 items from cheboxlist then calculate running total of Apr-15,May-15,Jun-15
Sums Mohs Eds 30-Nov-15 5:37am    
Yes for that in the header place a checkbox and in its event change you will have to do what is refered in the link provided in the solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900