We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to bind TimeSpan value to Grid column

Platform: ASP.NET Web Forms |
Control: Grid

We cannot bind the Timespan value directly to the grid columns. This is a known limitation due to the fact that there is no Timespan datatype in Javascript. Also the .Net JavascriptSerailizer will serializes the TimeSpan object to Complex object, and hence trying to bind the Timespan value directly in grid columns will display the column value as [object Object].

In such cases, we can use the Column template feature of the grid to display the TimeSpan values in desired format.

For example we can use the following Jsrender custom converter to format the timespan value.


In the following code snippets, we have demonstrated, how to use the column template to display the timespan value in grid.

Grid Initialization






The grid data has been returned from the below function.


The output will be as follows.


Figure 1: Grid with Timespan column without using template - see highlighted column

Figure 2: Grid with Timespan column using template - see highlighted column

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
You must log in to leave a comment
Mikhail Krasnobaev
Mar 04, 2016
Good day. Updated JQuery.globalize of ver. 1.0.0 does not use Globalize.format(val, "D2") anymore - https://github.com/jquery/globalize/blob/master/doc/migrating-from-0.x.md#globalizeformat Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile