Login failed for user 'cdmslm_country'.
at ApplicationModule.GetDataTable(String SQL, String TableName) in D:\hshome\cdmslm\oh-indian.com\App_Code\ApplicationModule.vb:line 204
at Controls_LeaveAReply.LoadComments() in D:\hshome\cdmslm\oh-indian.com\Controls\LeaveAReply.ascx.vb:line 37 ASP.NET - Formatting Date Field in Grid View
Home SWOT Analysis How Strong U R? Articles About Us
Mahatma Gandhi Jawaharlal Nehru Bagat Singh Kamarajar Indira Gandhi

Oh Indian

In remembrance of the Independance day Aug 15, 2007

This site is dedicated to one and all who sincerely participated in freedom struggle. Let us try to fulfill their ambitions!
Skip Navigation Links

ASP.NET - Formatting Date Field in Grid View


Sometimes we wish to display the date and time differently than the system settings oriented display.

For example we wish to display in the formats dd-MMM-yy or dd-MMM-yy HH:mm:ss or simply
MMM-yyyy etc.

This is very simple to achieve. Do the following steps in order to do like this.

  1. Open the Properties window using GridView Tasks menu.
  2. Enter the DateFormatString property as shown in the picture. Make sure to enter a valid format string.
  3. Set the DataFormatString Property
  4. Don't forget to mark the HTMLEncode property to False.
  5. Setting the HTMLEncode to False
  6. Run to view the result.
COMMENTS FROM USERS
Leave a Reply
Name (Required)  
Mail (will not be published) (required)    
Website
 
Label