How to stop the Calendar after clicking button if it doesn't match the condition

2 posts, 0 answers
  1. Blind
    Blind avatar
    1 posts
    Member since:
    May 2011

    Posted 04 May 2011 Link to this post

    Hi,
    We use the RadDatePicker in our project. When the user click the RadDatePicker button to select the date, we will check if the condition is not matched, we need to cancel the action. And I have tried several ways, but they don't work.

     
    function dateSelected(datepickerInstance, args) {
                    args.CancelOpen = true;
                    return false;
                }

    <telerik:RadDatePicker runat="server" ID="rdp1">
        <DateInput ID="DateInput2" CausesValidation="True" runat="server"></DateInput>
        <Calendar ID="Calendar2" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"   ViewSelectorText="x" runat="server"></Calendar>
        <DatePopupButton HoverImageUrl="" ImageUrl=""/>
        <ClientEvents OnPopupOpening="dateSelected" />
    </telerik:RadDatePicker>

    Please help me.

    Thanks a lot!

    Blind

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 May 2011 Link to this post

    Hello Blind,

    You can achieve this in OnPopupOpening client-side event handler.

    Javascript:
    <script type="text/javascript">
      function dateSelected(datepickerInstance, args)
     {
     args.set_cancel(true);
     }
    </script>

    Also check the following documentation.
    OnPopupOpening.

    Thanks,
    Shinu.
Back to Top