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

RadGrid - GridDateTimeColumn - Set date portion

2 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Curtis
Top achievements
Rank 1
Curtis asked on 04 Jun 2009, 03:44 PM
I have a RadGrid that has a GridDateTimeColumn in it that has the PickerType set to TimePicker so that the user can only select the time portion.  I need to be able to set the Date portion programaticlly so that when I do the insert/edit to the DB the date is set properly.  I'm using the Automatic Datasource Operations of the grid.

I'm sure there is a way to do this but I can't figure it out.  I've tried accessing the value of the column in the _ItemCommand event but can't get to that level.

Thanks
Curtis

2 Answers, 1 is accepted

Sort by
0
Curtis
Top achievements
Rank 1
answered on 04 Jun 2009, 07:01 PM
EDIT:
When I try to update an existing record the date portion of the GridDateTimeColumn is reset to the current date when the user selects a different time from the TimePicker.  I would expect the TimePicker to only affect the time portion of a DateTime instead of resetting the date also.  Is this possibly a bug?
0
Nikolay Rusev
Telerik team
answered on 10 Jun 2009, 06:37 AM
Hello Curtis,

Unfortunately RadTimePicker will use current date and selected time to build SelectedDate value of the control. You can workaround this behavior by storing original DateTime on UpdateCommand and later on Updating of DataSourceControl change the value in Parameters collection of the data source.

For your convenience I am attaching sample project. To run it you need to place Telerik.Web.UI assembly into the bin folder.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Curtis
Top achievements
Rank 1
Answers by
Curtis
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or