Hide or Show TimeSlotContextMenu

4 posts, 0 answers
  1. James
    James avatar
    11 posts
    Member since:
    Apr 2013

    Posted 21 May 2013 Link to this post

    Now, I'm using RadScheduler to book the ticket for a cinema.
    for example, on 21/05/2013,  for this movie named "Movie1", if the tickets still avaliable, TimeSlotContextMenu should Show, otherwies , need to hide TimeSlotContextMenu.
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 21 May 2013 Link to this post

    Hello James,

    Attached to this ticket you can find a very simplified runnable page demonstrating how to disable the items from the context menu depending on the particular time slot in the RadScheduler. Of course you can further expand the logic so that it complies with your particular scenario.

    Kind regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. James
    James avatar
    11 posts
    Member since:
    Apr 2013

    Posted 21 May 2013 Link to this post

    Hi Kate,
     
     protected void OnTimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
    {

     if (e.TimeSlot.Start.Date < DateTime.Now.Date)
      e.TimeSlot.Control.Attributes.Add("isHide", "true");
    else
      e.TimeSlot.Control.Attributes.Add("isHide", "false");

    }

    How to get the value of Attributes "isHide" in event
     function onClientTimeSlotContextMenu(sender, args) {

    var menu= sender.get_timeSlotContextMenus()[0].get_items().getItem(0);
    //menu.hide() or menu.show() based on Attributes "isHide".

    }

  4. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 22 May 2013 Link to this post

    Hi James,

    In your particular case you can use the following line of code in order to get the value of the isHide attribute as explained in more details here:
     

    //returns the value of isHide attribute  
     sender.get_timeSlotContextMenus()[0].get_items().getItem(1).get_attributes().getAttribute("isHide");
     

    Regards,
    Kate
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top