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

No .SelectedDate when custom Id is set

2 Answers 71 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 18 Mar 2008, 09:36 AM
Hello everybody!

I need to add a RadDateTimePicker programatically in my UserControl. Actually everything works fine, except when I set the Id of the raddatetimepickercontrol manually.
If I do so, .SelectedDate always returns the Date that was set intially.

example:
ctrl = new RadDateTimePicker(); 
ctrl.ID = DateTime.Now.Ticks.ToString(); 
ctrl.selectedDate = DateTime.Parse("01-01-2001"); 


Creating the control with this code always returns "01-01-2001" as .SelectedDate - allthough the date was changed (and the change is visible on the page).

However the following snippet:

ctrl = new RadDateTimePicker(); 
//ctrl.ID = DateTime.Now.Ticks.ToString(); 
ctrl.selectedDate = DateTime.Parse("01-01-2001"); 

acts how it is supposed to be.

Unfortunately I have to set an Id manually, b/c I also want to programatically add Asp RequiredFieldValidators!

Thx in advance for your help & kind regards!
 Markus

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 18 Mar 2008, 09:45 AM
Hello Markus,

The ID for an ASP.NET control should be the same across post-backs otherwise the control will unable to load needed state.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 2
answered on 18 Mar 2008, 09:57 AM
allright...
 nothing left to say.

Thx for fixing my clumsiness :-/


Tags
Calendar
Asked by
Markus
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Markus
Top achievements
Rank 2
Share this question
or