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. General Programming
  3. C#
  4. Problem Displaying moneyfield in gridview

Problem Displaying moneyfield in gridview

Scheduled Pinned Locked Moved C#
help
6 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.
  • B Offline
    B Offline
    Bubbles2
    wrote on last edited by
    #1

    I am trying to display a moneyfield in a gridview but it displays as 14.9500 instead of 14.95$ Can anyone help please , I have tried editing as {0:c} and {0:0.00} which works for a datalist but not for the display in gridview.:confused::confused::confused:

    K H 2 Replies Last reply
    0
    • B Bubbles2

      I am trying to display a moneyfield in a gridview but it displays as 14.9500 instead of 14.95$ Can anyone help please , I have tried editing as {0:c} and {0:0.00} which works for a datalist but not for the display in gridview.:confused::confused::confused:

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      Create a template column and then in the label set the text to: Text='<%# Convert.ToDouble(DataBinder.Eval(Container.DataItem,"moneyfield")).ToString("C") %>' Hope that helps. Ben

      1 Reply Last reply
      0
      • B Bubbles2

        I am trying to display a moneyfield in a gridview but it displays as 14.9500 instead of 14.95$ Can anyone help please , I have tried editing as {0:c} and {0:0.00} which works for a datalist but not for the display in gridview.:confused::confused::confused:

        H Offline
        H Offline
        Hayder Marzouk
        wrote on last edited by
        #3

        Hi, Set the DefaultCellStyle.Format property of the column to c HTH. Hayder Marzouk

        B 1 Reply Last reply
        0
        • H Hayder Marzouk

          Hi, Set the DefaultCellStyle.Format property of the column to c HTH. Hayder Marzouk

          B Offline
          B Offline
          Bubbles2
          wrote on last edited by
          #4

          Thanks for your prompt reply but when I edit Gridview columns I can't find this property.:confused:

          H 1 Reply Last reply
          0
          • B Bubbles2

            Thanks for your prompt reply but when I edit Gridview columns I can't find this property.:confused:

            H Offline
            H Offline
            Hayder Marzouk
            wrote on last edited by
            #5

            Hi, My response works in a .Net 2.0 Windows Forms application not is an ASP.NET Project. So... - Edit the gridview columns - Select ure column - Select the property DefaultCellStyle and click the button in the right. - You will find the Format property in a new opened property form - Set the property to c HTH. Hayder Marzouk

            B 1 Reply Last reply
            0
            • H Hayder Marzouk

              Hi, My response works in a .Net 2.0 Windows Forms application not is an ASP.NET Project. So... - Edit the gridview columns - Select ure column - Select the property DefaultCellStyle and click the button in the right. - You will find the Format property in a new opened property form - Set the property to c HTH. Hayder Marzouk

              B Offline
              B Offline
              Bubbles2
              wrote on last edited by
              #6

              Thanks a lot for your help I am using an ASP.NET web site.

              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