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. Date format in GridView control

Date format in GridView control

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-net
4 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.
  • A Offline
    A Offline
    Atul Kharecha
    wrote on last edited by
    #1

    Friends, I am using GridView control of ASP.NET 2.0. I want to format date column in the format of dd/mm/yyyy (it is showing me time and unwanted format). How can I do that? Thanks.

    I T A 3 Replies Last reply
    0
    • A Atul Kharecha

      Friends, I am using GridView control of ASP.NET 2.0. I want to format date column in the format of dd/mm/yyyy (it is showing me time and unwanted format). How can I do that? Thanks.

      I Offline
      I Offline
      Imran Khan Pathan
      wrote on last edited by
      #2

      Hi atul you have to write code in RowDataBound event of gridview. like this if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[3].Text = Convert.ToDateTime(ds.Tables[0].Rows[e.Row.RowIndex]["BDate"]).ToShortDateString(); } // here, ds is a dataset and "BDate" is a field name of the table Pathan

      1 Reply Last reply
      0
      • A Atul Kharecha

        Friends, I am using GridView control of ASP.NET 2.0. I want to format date column in the format of dd/mm/yyyy (it is showing me time and unwanted format). How can I do that? Thanks.

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

        Hi try this

        1 Reply Last reply
        0
        • A Atul Kharecha

          Friends, I am using GridView control of ASP.NET 2.0. I want to format date column in the format of dd/mm/yyyy (it is showing me time and unwanted format). How can I do that? Thanks.

          A Offline
          A Offline
          Atul Kharecha
          wrote on last edited by
          #4

          Thanks. I got solution by adding this. Without giving HtmlEncode="False", date format is not working. Wow !!

          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