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. how to calculate total in the gridview

how to calculate total in the gridview

Scheduled Pinned Locked Moved ASP.NET
csharptutorialasp-net
3 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.
  • D Offline
    D Offline
    developerit
    wrote on last edited by
    #1

    hi iam using asp.net with c# in my gridview 1st column is checkbox select productname price quantity total () rose 124 6 124*6 () biscuits 345 89 345*89 () choclate 670 45 670*45 ======= 67000 ======== when user enters quantity automatically in total colum total is displayed please can you give some example for this ...

    R G 2 Replies Last reply
    0
    • D developerit

      hi iam using asp.net with c# in my gridview 1st column is checkbox select productname price quantity total () rose 124 6 124*6 () biscuits 345 89 345*89 () choclate 670 45 670*45 ======= 67000 ======== when user enters quantity automatically in total colum total is displayed please can you give some example for this ...

      R Offline
      R Offline
      Randal Vance Cunanan
      wrote on last edited by
      #2

      Uhm.. maybe you can calculate the Total in advanced before you databind to the Grid View. Or you can use a nested foreach loop for each row and cell and extract the value then do the calculations and assign that in the Total Column.

      1 Reply Last reply
      0
      • D developerit

        hi iam using asp.net with c# in my gridview 1st column is checkbox select productname price quantity total () rose 124 6 124*6 () biscuits 345 89 345*89 () choclate 670 45 670*45 ======= 67000 ======== when user enters quantity automatically in total colum total is displayed please can you give some example for this ...

        G Offline
        G Offline
        Gary Stafford
        wrote on last edited by
        #3

        You could do it on the client-side with jQuery and save a lot of server-side processing and roundtrips. It would be easy to attach an event listener to the checkbox and total all the item's subtotals, etc. Here is a link to an example that updates the total the items in the order table as you add and remove items. It doesn't use Web Forms, but just as easily could: Interactive Form Functionality on the Client-Side Using jQuery[^]. There is a working example at http://altweb.lazerinc.com/jquery/order_dev.htm[^].

        Regards, Gary

        modified on Monday, April 5, 2010 9:09 AM

        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