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

No SelectedDateChanged Event raised (DatePicker programatically)

2 Answers 118 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 16 Jul 2009, 03:53 PM
I have a problem with the RadDatePicker's Event "selectedDateChanged". It raises without problems if it was created in the Markup, and the eventhandler is attached there such as:

<rad:RadDatePicker ID="rdp1" AutoPostBack="true" runat="server"  
        onselecteddatechanged="rdp1_SelectedDateChanged"></rad:RadDatePicker> 

If this Control is created by code, NO Eventhandler will fire:
RadDatePicker rdp = new RadDatePicker(); 
            rdp.SelectedDate = new DateTime(2009, 5, 4); 
            rdp.AutoPostBack = true;             
            rdp.SelectedDateChanged += new SelectedDateChangedEventHandler(rdp_SelectedDateChanged); 
this.Controls.Add(rdp); 
             

I searched for help here in the forum but I didn't get the trick to let the Handler fire....

Please help ;)

Thanks already
Frithjof

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel
Telerik team
answered on 21 Jul 2009, 11:36 AM
Hi Fred,

I am attaching a sample page which is working as expected on my end. Try it and let me know if you encounter any problems with it.

Greetings,
Pavel
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.
0
Fred
Top achievements
Rank 1
answered on 21 Jul 2009, 01:19 PM
Hey Pavel,

thanks for your help! I worked it out now!

I used the "normal" ASP-Radcontrols, as soon as I switched the non-AJAX-Datepicker with the AJAX-Datepicker, the Eventhandler fired suddenly. But I still don't know why the other control didn't! Anyway.... it works, and so my problem is gone...

Thanks again, i can now replace the buggy Calendar I used with the RadDatePicker, cheers!

Kind regards
Frithjof
Tags
Calendar
Asked by
Fred
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Fred
Top achievements
Rank 1
Share this question
or