Format dates in a Gridview column
To format a gridview column to display dates properly , two properties needs to be changed, the DateFormatString property and the HTML encode property. After setting the DateFormatString the HTMLEncode property should be set to false. For Example :
<asp:BoundField DataField="RegistrationDate" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Date"
HtmlEncode="False" SortExpression="RegistrationDate" />
Related posts:
- Enable or disable the delete link in the GridView according to the role of the logged in user In some scenarios you may only want users of a...
- Efficient Search Engine Friendly Gridview Paging control The Gridview Control in ASP.NET has built in paging support....
Related posts brought to you by Yet Another Related Posts Plugin.