RadDatePicket SelectedDateChanged Event Not Firing When DateInput Disabled

4 posts, 0 answers
  1. Michael
    Michael avatar
    27 posts
    Member since:
    May 2011

    Posted 19 May 2015 Link to this post

    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?
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 22 May 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael
    Michael avatar
    27 posts
    Member since:
    May 2011

    Posted 22 May 2015 in reply to Viktor Tachev Link to this post

    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>

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 25 May 2015 Link to this post

    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
Back to Top