No .SelectedDate when custom Id is set

3 posts, 0 answers
  1. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 18 Mar 2008 Link to this post

    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. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 18 Mar 2008 Link to this post

    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
  3. Markus
    Markus avatar
    103 posts
    Member since:
    Dec 2007

    Posted 18 Mar 2008 Link to this post

    allright...
     nothing left to say.

    Thx for fixing my clumsiness :-/


Back to Top