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

Set Value for DateTime Column

2 Answers 32 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Loretta Stokes
Top achievements
Rank 1
Loretta Stokes asked on 16 Apr 2010, 10:22 PM
I am having two issues with setting the value for a column that is a date time ( in xaml it is GridViewDataColumn bound to a DateTime field).

1. I have an option for the user to add a new row. I call BeginInsert() on the grid. When the row is added I want to set a specific default date instead of 0001/1/1. I tried adding code to do this in the BeginningEdit event. It looked good but when you select the cell it goes back to the bad date. I am not sure what I am missing here. 

2. If I try to enter the time by typing it for the same date time column it is ignored. I can type it but when I hit enter it goes back to 12:00 AM. Is there a way to do this?

2 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 21 Apr 2010, 05:00 PM
Hello Loretta Stokes,

Straight onto your questions:

1. "BeginningEdit" event should be used if you want to cancel editing process. You can use "AddingNewDataItem" event - within the handler you can set e.NewObject to an instance of your business object (with correct date).

2. Default editor for this configuration is RadDatePicker not RadTimePicker. However you can take a look at the attached example which demonstrates how to create custom column that covers your requirements.

Let me know if there is something unclear.

Sincerely yours,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Loretta Stokes
Top achievements
Rank 1
answered on 21 Apr 2010, 07:21 PM
Thank you for your response and the example. This certainly answers my question.
Tags
GridView
Asked by
Loretta Stokes
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Loretta Stokes
Top achievements
Rank 1
Share this question
or