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

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

1 Answer 54 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Blind
Top achievements
Rank 1
Blind asked on 04 May 2011, 08:17 AM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 May 2011, 09:02 AM
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.
Tags
Calendar
Asked by
Blind
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or