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. Footer Dataformat

Footer Dataformat

Scheduled Pinned Locked Moved ASP.NET
questioncsshelp
11 Posts 3 Posters 2 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.
  • T triton630

    Hi all, I have a datagrid with some cost information. In the footer for column totalcost, i have calculated the total cost of all items in the grid. The problem is that the footer dataformat is not in the format $100.00, instead it is in the format 100. The items in that column are in the correct format because when i created the column i set the dataformatstring property to {0:c}. Why doesn't that carry over to the footer? How do I set that in the footer? Thanks.

    M Offline
    M Offline
    Marcie Jones
    wrote on last edited by
    #2

    Where/how are you populating the Footer cell? Marcie CP Blog[^]

    T 1 Reply Last reply
    0
    • M Marcie Jones

      Where/how are you populating the Footer cell? Marcie CP Blog[^]

      T Offline
      T Offline
      triton630
      wrote on last edited by
      #3

      The grid is a shopping cart. I add a row to the cart when the user selects an addtocart button. In the onclick event, i am calculating and populating the cell. gridShoppingCart.Columns[3].FooterText = dtCart.Compute("Sum(TotalValue)", "").ToString();

      M P 2 Replies Last reply
      0
      • T triton630

        The grid is a shopping cart. I add a row to the cart when the user selects an addtocart button. In the onclick event, i am calculating and populating the cell. gridShoppingCart.Columns[3].FooterText = dtCart.Compute("Sum(TotalValue)", "").ToString();

        M Offline
        M Offline
        Marcie Jones
        wrote on last edited by
        #4

        Try: gridShoppingCart.Columns[3].FooterText = String.Format("{0:c}", dtCart.Compute("Sum(TotalValue)", "")); Marcie CP Blog[^]

        P T 3 Replies Last reply
        0
        • T triton630

          The grid is a shopping cart. I add a row to the cart when the user selects an addtocart button. In the onclick event, i am calculating and populating the cell. gridShoppingCart.Columns[3].FooterText = dtCart.Compute("Sum(TotalValue)", "").ToString();

          P Offline
          P Offline
          Paul Watson
          wrote on last edited by
          #5

          gridShoppingCart.Columns[3].FooterText = **string.format("{0:C}",** dtCart.Compute("Sum(TotalValue)", "")); would be one way. regards, Paul Watson Bluegrass South Africa Chris Maunder wrote: "I'd rather cover myself in honey and lie on an ant's nest than commit myself to it publicly." Jon Sagara replied: "I think we've all been in that situation before." Crikey! ain't life grand?

          T 1 Reply Last reply
          0
          • M Marcie Jones

            Try: gridShoppingCart.Columns[3].FooterText = String.Format("{0:c}", dtCart.Compute("Sum(TotalValue)", "")); Marcie CP Blog[^]

            P Offline
            P Offline
            Paul Watson
            wrote on last edited by
            #6

            snap, except I highlighted my code... though you actually used the correct syntax case :-D regards, Paul Watson Bluegrass South Africa Chris Maunder wrote: "I'd rather cover myself in honey and lie on an ant's nest than commit myself to it publicly." Jon Sagara replied: "I think we've all been in that situation before." Crikey! ain't life grand?

            M 1 Reply Last reply
            0
            • P Paul Watson

              snap, except I highlighted my code... though you actually used the correct syntax case :-D regards, Paul Watson Bluegrass South Africa Chris Maunder wrote: "I'd rather cover myself in honey and lie on an ant's nest than commit myself to it publicly." Jon Sagara replied: "I think we've all been in that situation before." Crikey! ain't life grand?

              M Offline
              M Offline
              Marcie Jones
              wrote on last edited by
              #7

              Great minds think alike :) ! Marcie CP Blog[^]

              1 Reply Last reply
              0
              • M Marcie Jones

                Try: gridShoppingCart.Columns[3].FooterText = String.Format("{0:c}", dtCart.Compute("Sum(TotalValue)", "")); Marcie CP Blog[^]

                T Offline
                T Offline
                triton630
                wrote on last edited by
                #8

                Gah! So simple. Thanks for your help.

                1 Reply Last reply
                0
                • P Paul Watson

                  gridShoppingCart.Columns[3].FooterText = **string.format("{0:C}",** dtCart.Compute("Sum(TotalValue)", "")); would be one way. regards, Paul Watson Bluegrass South Africa Chris Maunder wrote: "I'd rather cover myself in honey and lie on an ant's nest than commit myself to it publicly." Jon Sagara replied: "I think we've all been in that situation before." Crikey! ain't life grand?

                  T Offline
                  T Offline
                  triton630
                  wrote on last edited by
                  #9

                  :) Thanks for your help as well.

                  1 Reply Last reply
                  0
                  • M Marcie Jones

                    Try: gridShoppingCart.Columns[3].FooterText = String.Format("{0:c}", dtCart.Compute("Sum(TotalValue)", "")); Marcie CP Blog[^]

                    T Offline
                    T Offline
                    triton630
                    wrote on last edited by
                    #10

                    Marcie, Silly question. Is there a way to convert it back to just the string 15.00, using the String.Format function? Or should I just remove the $ manually?

                    M 1 Reply Last reply
                    0
                    • T triton630

                      Marcie, Silly question. Is there a way to convert it back to just the string 15.00, using the String.Format function? Or should I just remove the $ manually?

                      M Offline
                      M Offline
                      Marcie Jones
                      wrote on last edited by
                      #11

                      Depending on what you're looking for, you may want to use a different format, see this post for some good examples: String Formatting Marcie P.S. It wasn't a silly question :) CP Blog[^]

                      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