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. GridView column formatting

GridView column formatting

Scheduled Pinned Locked Moved ASP.NET
wpfwcfquestion
3 Posts 2 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
    Drew McGhie
    wrote on last edited by
    #1

    I have a gridview that I'm correctly binding correctly, but I can't seem to get the formatting of a datetime column correct and was hoping I could get some advice on what I'm doing wrong. The column, I have defined as I originally had DataFormatString="MM/dd/yyyy", but that literally displayed just that, so the {} part helped. Now, however, it displays the time in addition to the date, which is something I don't want. Is there some trick with the number before, or the specific formatting that I'm using that is making it display the full datetime?

    M 1 Reply Last reply
    0
    • D Drew McGhie

      I have a gridview that I'm correctly binding correctly, but I can't seem to get the formatting of a datetime column correct and was hoping I could get some advice on what I'm doing wrong. The column, I have defined as I originally had DataFormatString="MM/dd/yyyy", but that literally displayed just that, so the {} part helped. Now, however, it displays the time in addition to the date, which is something I don't want. Is there some trick with the number before, or the specific formatting that I'm using that is making it display the full datetime?

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, You simply set the BoundField.HtmlEncode Property [^] to false as this property has the true value by default and this causes the formatting not to work.

      D 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, You simply set the BoundField.HtmlEncode Property [^] to false as this property has the true value by default and this causes the formatting not to work.

        D Offline
        D Offline
        Drew McGhie
        wrote on last edited by
        #3

        Worked perfectly, thanks.

        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