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

[Solved] RadDatePicker in FormTemplate

1 Answer 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 2
Steve asked on 27 Mar 2008, 06:36 PM
Hi,

After hours of trying to figure it out I'm giving up - why is it so hard to get the selected date out of the RadDatePicker inside of the RadGrid FormTemplate?  Here's my scenario: I have a Collection of objects that I'm trying to bind to RadGrid.  That part works fine - when I first load my items everything, including the dates, is displaying fine.  The problem starts when I try to update/insert items.  With the update I tried binding the Date in my objects to SelectedDate and DbSelectedDate - neither works.  The day will show up in the form, but no matter what I, after I hit update the date goes back to what it was originally.  I intercept the update command and modify my objects, but when I put a breakpoint right after my date assignment, I can see that the SelectedDate and DbSelectedDate is set to what it was originally and not what I have selected.
With Insert command the story is similar - when I insert a new item the date I selected disappears and instead a null value is placed in my objects.  Editing them doesn't change anything - selected values are always overwritten with the original, null value.
I am beyond frustrated at this, seeing as all I'm trying to do is get a simple value from the RadDatePicker.  Why is it so hard??

I have looked at all the examples of using the DbSelectedDate and all - none of them seem to help me

Thanks,

Marek

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 28 Mar 2008, 01:29 PM
Hello Marek,

I have created a sample page, that follows your description -- RadGrid is databound to an array of one (for simplicity) object with a DateTime property. The grid has a RadDatePicker control in the form template. The page shows how to retrieve the value from the RadDatePicker. The underlying data source (the only object here) is updated and then the grid is displayed fine with the new data. The page can be downloaded from here.

All the best,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Steve
Top achievements
Rank 2
Answers by
Ves
Telerik team
Share this question
or