Change date format in gridview

Total Post:2

Points:14
C#
 280  View(s)
Ratings:
Rate this:

Hi, 

    I want to change format of datefield in my gridview. Below is my code.

 grid.Column("CreationDate", "Creation Date",  item.CreationDate)),

Please give me some solution to accomplish my task.

  1. Post:44

    Points:310
    Re: Change date format in gridview

    Hi Sara,

                I analyzed your code. Please follow below line of code to achieve your task.

     grid.Column("CreationDate", "Creation Date", format: (item) => string.Format("{0:dd-MM-yyyy}", item.CreationDate)),

    Hope its informative......

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!