Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Calculations in datagrid

Calculations in datagrid

Scheduled Pinned Locked Moved ASP.NET
tutorial
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Imthu
    wrote on last edited by
    #1

    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

    V 1 Reply Last reply
    0
    • I Imthu

      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

      V Offline
      V Offline
      Vsree
      wrote on last edited by
      #2

      hi Try this link http://www.dotnetjunkies.com/Tutorial/2F527E21-A6C5-497A-8B56-4150BDAF711D.dcik[^]

      I 1 Reply Last reply
      0
      • V Vsree

        hi Try this link http://www.dotnetjunkies.com/Tutorial/2F527E21-A6C5-497A-8B56-4150BDAF711D.dcik[^]

        I Offline
        I Offline
        Imthu
        wrote on last edited by
        #3

        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

        V 1 Reply Last reply
        0
        • I Imthu

          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

          V Offline
          V Offline
          Vsree
          wrote on last edited by
          #4

          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 !:)

          I 1 Reply Last reply
          0
          • V Vsree

            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 !:)

            I Offline
            I Offline
            Imthu
            wrote on last edited by
            #5

            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

            M 1 Reply Last reply
            0
            • I Imthu

              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

              M Offline
              M Offline
              Marcus J Smith
              wrote on last edited by
              #6

              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

              I 1 Reply Last reply
              0
              • M Marcus J Smith

                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

                I Offline
                I Offline
                Imthu
                wrote on last edited by
                #7

                ok thanks a lot... I ll try this method...

                with Regards, Imthiyas Ahamed.A

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups