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

[Solved] GridDateTimeColumn TimeSpan UpdateValues

1 Answer 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeffrey Lawson
Top achievements
Rank 2
Jeffrey Lawson asked on 23 Oct 2009, 10:13 PM

 

I believe a bug exists when using a GridDateTimeColumn DataType="System.TimeSpan" PickerType="TimePicker" DataFormatString="{0:t}" and then attempting UpdateValues in the code behind. UpdateValues fails because the value returning is DateTime instead of TimeSpan.

<telerik:GridDateTimeColumn DataType="System.TimeSpan" PickerType="TimePicker" DataFormatString="{0:t}" EditFormColumnIndex="2" HeaderText="End Time" DataField="TimeEnd" UniqueName="TimeEnd" />

 

void RadGrid_UpdateCommand(object source, GridCommandEventArgs e)

{

    var editableItem = ((GridEditableItem)e.Item);

    var id = (long)editableItem.GetDataKeyValue("Id");

    using (DataContext context = new DataContext())

    {

        var frequencyLocation = context.FrequencyLocation.ByKey(id);

        if (frequencyLocation != null)

        {

            editableItem.UpdateValues(frequencyLocation);

            context.SubmitChanges();

        }

    }

}

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 28 Oct 2009, 03:27 PM
Hello Jeffrey,

Could you modify the attach sample so that the problem is reproduced - I tried but to no success.

Thanks.

All the best,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Jeffrey Lawson
Top achievements
Rank 2
Answers by
Tsvetoslav
Telerik team
Share this question
or