I have a ASP.Net webform with a GridView control. I display a dataset from a SQL Server table in this GridView. One of the columns is a DateTime field.
How can I make the DateTime column display just the date in the GridView control? Right now the full DateTime from the field displays in the column. How can I get rid of the time portion for display purposes in the GridView? Hi, Jerry,
First, in the column definition, set the DataFormatString to {0:d}
Second, (if you're using ASP.NET 2.0), set the HTMLEncode property to false. (This is a new security feature in ASP.NET 2.0 to deal with cross-page postbacks).
Hope that helps...
Kevin