Click here to Skip to main content
16,012,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i need to calculate cumulative frequeccy like this:
a b c
1 2 2
1 3 5
1 6 11
2 4 4
2 1 5
2 5 10
3 2 2
3 4 6

but
for me the output is getting like this

a b c
1 2 2
1 3 5
1 6 11
2 4 4
2 1 5
2 5 10
3 2 12
3 4 16

my coding is:
C#
ArrayList dataArray = new ArrayList();


   for (int rowIndex = gv1.Rows.Count - 2; rowIndex > 0; rowIndex--)
   {


   //for (int rowIndex = 1; rowIndex < gv1.Rows.Count; rowIndex++)
   //{

       //int rowIndex = gv1.Rows.Count;
       //GridViewRow row1 = gv1.Rows[rowIndex];
       GridViewRow previousRow = gv1.Rows[rowIndex + 1 ];
       int c1 = 0;
       int cv1 = 0;


       foreach (GridViewRow row1 in gv1.Rows)
       {
           //for (int i = 0; i < row1.Cells.Count; i++)
           //{

               if (row1.Cells[1].Text != previousRow.Cells[1].Text)
               {

                   //row2 = row1;
                   cv1 = System.Convert.ToInt32(row1.Cells[4].Text);
                   c1 += cv1;
                   row1.Cells[5].Text = c1.ToString();
                   dataArray.Add(c1);
               }

           //}
       }

       //break;
           }


can any one say me the suggestion for this
Posted
Updated 21-Feb-11 21:59pm
v4

1 solution

Did you not ask a similar question a few days ago[^]?
 
Share this answer
 
Comments
gowdhami 22-Feb-11 1:54am    
it is not similar to that ... in that the cf is calculated for all the gridview value. it is not like that.. please read the question with the example

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