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

RadDatePicket SelectedDateChanged Event Not Firing When DateInput Disabled

3 Answers 438 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 2
Iron
Iron
Iron
Michael asked on 19 May 2015, 02:15 PM
In previous releases of the UI for ASP.NET AJAX Forum the OnSelectedDateChanged event on the RadDatePicker would fire even if the associated DateInput control was marked as disabled (to prevent users typing in date value and force use of calendar flyout).  However, I upgraded to build 2015.1.401.45 recently and this behavior is not working anymore - I have to enable the DateInput control for the event to fire and for the DateInput to reflect the selected date from the calendar.  Was this by design and should I be using some other attribute to prevent direct user date inputs or is this a bug?

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 22 May 2015, 11:11 AM
Hello Michael,

The behavior you describe is rather strange. I tried to replicate it on my end, however, I was not able to. The OnClientDateChanged should be fired even if the DateInput is set as disabled.

For reference I am attaching the sample project I used for testing. There are two RadDatePicker controls on the page. The DateInput is set as disabled and ReadOnly for the first and second RadDatePicker respectively. The OnClientDateChanged event is fired as expected for both controls on my end.

Would you give the sample a try and let me know if I am missing something? I would appreciate it if you can describe what should be changed in order to replicate the problematic behavior.

On a side note, please open the browser console by pressing F12 and ensure that there are no JavaScript errors listed. If there are such errors the will interfere with the normal operation of the controls.

Regards,
Viktor Tachev
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Michael
Top achievements
Rank 2
Iron
Iron
Iron
answered on 22 May 2015, 04:21 PM

Viktor,

It is the server side OnSelectedDateChanged event that is not firing properly and/or if the DateInput is marked as disabled it will not retain the selected date.  If I mark the DateInput controls as ReadOnly and remove the Enabled="false" attribute it does work but previously when I just had the Enabled="false" set without the ReadOnly attribute it worked fine and the server-side event fired just fine. I suppose I can live with the ReadOnly attribute but would like to know if the behavior was changed thus causing the server side event to not fire.  There are no JavaScript errors being triggered so not sure what the issue is.

 

<telerik:RadDatePicker ID="LastDayRadDatePicker" runat="server" AutoPostBack="true" TabIndex="6" Width="100px" CausesValidation="false"
OnSelectedDateChanged="LastDayRadDatePicker_SelectedDateChanged">
<DateInput runat="server" Enabled="false" DateFormat="MM/dd/yyyy"></DateInput>
</telerik:RadDatePicker>

0
Viktor Tachev
Telerik team
answered on 25 May 2015, 01:47 PM
Hello Michael,

Note that the DateInput renders an input element on the page. When an input is disabled its value is not submitted to the server. This behavior complies with the W3C specification,

This means that the value of the input would not be actually changed on the server side. Thus, the SelectedDateChanged is not fired.

If you would like additional information on the disabled and readonly mode of an input element you would find the following resources interesting.




Regards,
Viktor Tachev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Calendar
Asked by
Michael
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Viktor Tachev
Telerik team
Michael
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or