This is a migrated thread and some comments may be shown as answers.

Grid not formatting nullable datetime column

1 Answer 482 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 23 Oct 2013, 03:58 PM
I am having trouble with formatting a column that is bound to a nullable datetime field. The grid is bound on the client side using ajax. Wondering if anyone has seen this behavior before, and if so, what the solution was.

Here is the part of the grid instantiation code that formats the nullable datetime field:

columns.Bound(c => c.MediaFileVersion.MediaFile.LastCheckOutDate).ClientTemplate("<#= $.telerik.formatString('{0:MM/dd/yyyy - hh:mm tt}', GetDateFrom(LastCheckOutDate)) #>").Title("Check-out Date");
                        

The LastCheckOutDate field is of type nullable datetime.

The page has a javascript error like this:

Uncaught ReferenceError: LastCheckOutDate is not defined

It seems that Telerik grid does not know how to render a nullable datetime field. Would appreciate any help or ideas relating to the above problem.

Thank you




1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 28 Oct 2013, 12:56 PM
Hello Kevin,

The GridDateTimeColumn supports nullable values and should display empty cell if the value is null. I am attaching a sample project where the RadGrid has a GridDateTimeColum with null values.

From the provided code it would be hard to determine what is the reason for the error. Could you share your markup with the code behind so we could further investigate the issue and help you find a solution?


Regards,
Viktor Tachev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or