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
close icon

Passing TimeSpan Value to Entity


how can i save a TimeSpan Value in a Grid-Column and send it to Server?

3 Replies

RU Ragavee U S Syncfusion Team June 8, 2016 11:34 AM UTC

Hi Arthur, 

Thanks for your interest in Syncfusion products. 

We analyzed your requirement to bind TimeSpan column to grid and update the modified value to server. We have already discussed on “Binding TimeSpan value to Grid columns” in the below knowledge base link.  

We have achieved your requirement using the Column Template and EditTemplate feature of the Grid.  

Please refer to the below code example. 

<script type="text/javascript"> 
    $.views.converters("value", function(val) { 
    return ej.globalize.format(val,"D2");//get the formatted value 
<div style="margin:30px"> 
            . . . . 
           .Columns(col => 
                col.Field("Time").HeaderText("Time").EditTemplate(editTemp=>editTemp.Create("create").Write("write").Read("read")).Template("{{:Time.Hours}} : {{value:Time.Minutes}} : {{value:Time.Seconds}}").Add();//show the timespan value using template property; Time property will be obtained as complex object. 
<script type="text/javascript"> 
    function onGridCreate(args) { 
        this.model.columns[2].allowEditing = true; //if the column index is undefined, you can get the column object using the getColumnByField or getColumnByHeaderText method and thus update this property. 
    function create(args) { 
        return $("<input>"); 
    function write(args) { 
        //convert the element to ejTimePicker control 
            value: args.rowdata["Time"], 
            interval: 15, 
            timeFormat: "HH:mm:ss", 
            width: "100%" 
    function read(args) { 
        return args.ejTimePicker("getValue");//get the value from the TimePicker control 

We have prepared a sample with the above solution, which can be downloaded from the below location. 

Ragavee U S. 

AR Arthur June 8, 2016 01:52 PM UTC

Thanks, its working fine!:)

RU Ragavee U S Syncfusion Team June 9, 2016 04:22 AM UTC

Hi Arthur, 


Thanks for your update. 


We are happy that your requirement is achieved. 



Ragavee U S. 

SIGN IN To post a reply.
Live Chat Icon For mobile
Up arrow icon