Is there a way to format the columns in the grid control? We are displaying a date field on the grid and only want to show the date not the time.
Sorry, I did not realize that, in this case I found out only the hack that leverages including the following code in your selected columns: CONVERT(nvarchar(20), [yourdatetimecolumn], 107) AS DateOnly
CONVERT(nvarchar(20), [yourdatetimecolumn], 107) AS DateOnly
Hi Mark, you can create a custom transformation and change the column formatting there. For example, with the ASCX transformation you could use the following code: <%# ((DateTime)Eval("YourDateTimeColumn")).ToShortDateString() %>
<%# ((DateTime)Eval("YourDateTimeColumn")).ToShortDateString() %>
I don't see where this transformation would be applied. The grid only has a Selected item transformation for the detail view of the item.
I changed the grid to a querydatagrid and put the convert statement in the query and that did the trick. Still think its a bit silly cant format the selected columns through the interface.
Seems funny to me, too. I will ask around the office if there's a better solution once I'm at work :)
so I've talked about this with my colleagues and we regrettably found out that there is currently no other way around that.
Please, sign in to be able to submit a new answer.