Disable Edit and Delete and Insert after pass date and time

2 posts, 1 answers
  1. L
    L avatar
    295 posts
    Member since:
    Apr 2008

    Posted 16 Feb Link to this post

    hi

     How do I prevent any insert, edit and delete which is less than current date and time?

     

    Thanks a lot

  2. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    837 posts

    Posted 19 Feb Link to this post

    Hello,

    You can subscribe the Scheduler to the three events below, and in their handlers cancel the event if the user tries to create an event on a timeslot that precedes the current date or tries to edit/delete an existing appointment on such timeslot:
    function OnClientAppointmentInserting(sender, args) {
        var startTime = args.get_targetSlot().get_startTime();
        var currentDate = new Date();
     
        if (startTime < currentDate) {
            args.set_cancel(true);
        }
    }
     
    function OnClientAppointmentDeleting(sender, args) {
        var startTime = args.get_appointment().get_start()
        var currentDate = new Date();
     
        if (startTime < currentDate) {
            args.set_cancel(true);
        }
    }
     
    function OnClientAppointmentEditing(sender, args) {
        var startTime = args.get_appointment().get_start()
        var currentDate = new Date();
     
        if (startTime < currentDate) {
            args.set_cancel(true);
        }
    }

    The Scheduler client-side events are listed in this article. And the SchedulerAppointment objects's methods can be found here.

    Regards,
    Ivan Danchev
    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
Back to Top