Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hello everyone,

I'm trying to sum a row depending on a cell in front of the cell I want to sum and display the result in a label.

For example I would like to sum 5 and 20 because it's 8 in front of them and display the sum in one label, and sum 10 and 20 because it's 18 in front of them and display that sum in different label.
This should work on Button click event. I'm populating the datagrid from text boxes.


8
5
18
10
18
15
8
20



Thank you!
Posted
Updated 3-Dec-10 3:51am
v5
Comments
Mohd Wasif 3-Dec-10 8:13am    
Please clarify your question in detail to be answerable means on which event you want to do Page Load Event or grdiview Event

1 solution

If the data for the grid is in a database then I would think that your best bet is to use a stored procedure utilizing one of the variations of the SUM()[^] function.
 
Share this answer
 

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