Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web form in which i have to calculate the total of sales according to particular date like if x unit of item A is sold today and y unit of item B is sold today then total sales of today should be displayed as x+y units in grid view. How will I do that as quantities of sales are obtained after joining around 5 to 6 tables.



Thanx thursunamy being specific I want to ask that there are two fields name qty issued and qty received in my database and both have an id assigned to that as 1 and 2 respectively. The values for these are to be calculated separately and should be shown in the first row of the grid view. I have calculated the values but not able to show the total value in the first row of the grid view. How can i be able to do so?? Thanx in advance rply as soon as possible. An early response will be appreciated...
Posted
Updated 29-Nov-12 23:32pm
v2
Comments
thursunamy 30-Nov-12 4:41am    
Hi,

I am not sure I understood correctly but you can calculate it on server side and show on the grid html via inline coding.

1 solution

I am understand correctly, you have three column A, B, C and you want to show sum of A+B in C column, if this, then take C column as tempalte field and take a label and assign values of C to label on ROWDATABOUND event. Calculate values of C on ROWDATABOUND event.
 
Share this answer
 
Comments
Member 9644258 30-Nov-12 7:07am    
I just want to show the values of calculated fields in 1st row of the grid view which i am unable to do as total values appear in last row
Member 9644258 30-Nov-12 7:08am    
How will I be able to show the total value after calculation in first row of gridview
Er. Vikas Sangal 30-Nov-12 7:21am    
if you want to show sum of all rows at bottom then take a label control on FooterTempalte and assign values to label.
Click below link to check how to get values of A & B and after getinng then simply sumup and assign to Footer Label.
http://www.dotnetfunda.com/forums/thread9403-get-the-particular-value-in-gridview-using-rowdatabound-in-csharpnet.aspx
Member 9644258 30-Nov-12 7:24am    
No I don't want to show that in footer. I want to show them in first row of grid view.
Member 9644258 30-Nov-12 7:25am    
and that to not of all rows but particular column according to particular unit id and on a particular date

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