Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
Need code for next month and previous month button selected events
posted

hi,

On click of next month button and previous month button,I will be customizing the calendar.

Can you give me sample code for next/previos month button click event?

  • 24497
    Suggested Answer
    posted

    Hi,

    You may process ClientEvents.VisibleMonthChanged or VisibleMonthChanging.

    To check if source of event next/prev month "button", you may check if target of event is IMG. Below is example.

    <script type="text/javascript">
    function monthChanged(calendar, args)
    {
     var evt = args.get_browserEvent();
     var target = null;
     if(evt)
     {
      target = evt.target;
      if(!target)
       target = evt.srcElement;
     }
     if(target && target.nodeName == 'IMG')
      alert('next/prev button');
     alert('month changed:' + args.get_date() + ':' + args.get_oldDate());
    }
    </script>
    <ig:WebMonthCalendar ID="WebMonthCalendar1" runat="server">
           <ClientEvents VisibleMonthChanged="monthChanged" />
    </ig:WebMonthCalendar>