Calculations in datagrid
-
hai all, Can anyone guide me how to perform calculations in a datagrid by row wise as well as column wise.... Its urgent....plz
with Regards, Imthiyas Ahamed.A
-
-
ya i already tried that.. but the calculation has done only for columns... there is no calc for rows....Do u have anyidea about this....
with Regards, Imthiyas Ahamed.A
Try this
int[] it3= null; int it1 = 0; int it2 = 0; if(ds.Tables[0].Rows.Count>0) { it3 = new int[ds.Tables[0].Rows.Count]; for(int i=0;i This is by adding the 2 fields and display it in the grid. I only developed this..i couldnt directly add 2 columns in a row. Try and let me know !:)
-
Try this
int[] it3= null; int it1 = 0; int it2 = 0; if(ds.Tables[0].Rows.Count>0) { it3 = new int[ds.Tables[0].Rows.Count]; for(int i=0;i This is by adding the 2 fields and display it in the grid. I only developed this..i couldnt directly add 2 columns in a row. Try and let me know !:)
-
ya Sure i ll let u know about this by tomo.... i want to implement some formulas also in datagrid is it possible... have u ever worked like this before....
with Regards, Imthiyas Ahamed.A
What I would suggest is on the Datagrid_OnItemDataBound event you look at the Cells in each "Item" or row as it is bound to the grid. You pick out the cell values that you need and then perform the calculations while storing the values in session or whatever you need to do to maintain that variable. As each row is added you can put the value in an extra column or at the end in the footer or in some label somewhere. I've done this before where I add all the values in the currency column to come up with a total so it is possible to do either way.
Cleako
-
What I would suggest is on the Datagrid_OnItemDataBound event you look at the Cells in each "Item" or row as it is bound to the grid. You pick out the cell values that you need and then perform the calculations while storing the values in session or whatever you need to do to maintain that variable. As each row is added you can put the value in an extra column or at the end in the footer or in some label somewhere. I've done this before where I add all the values in the currency column to come up with a total so it is possible to do either way.
Cleako