Hide/Show Appointment Context Menu Items

7 posts, 1 answers
  1. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 17 Sep 2012 Link to this post

    Hi,

    I would like to show/hide context menu items based on some properties of the appointment.  Context menu items are added from server side code. I am using javascipt and webservice to do this. When I call the client side script "CheckTimerStatus" , it overrides the built in JS fxn that toggles the contextmenu. How can I make both codes execute without affecting each other.

    I am calling  OnClientAppointmentContextMenu="CheckTimerStatus"


    function  CheckTimerStatus (sender, eventargs){
      // hide/display contextmenuitems

    }

     protected void rsTicketsSchedule_DataBound(object sender, EventArgs e)
        {
           
            //AddMenuItemsToConetxtMenu
             ...........   Logic to add context menu based on some properties....

    }



    Thanks,
    Prava
  2. Answer
    Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 18 Sep 2012 Link to this post

    Hi Prava,

    You could try the following approach:
    function appointmentContextMenu(sender, args) {
        var date = new Date();
        if (args.get_appointment().get_start() < date) {
            sender.get_appointmentContextMenus()[0].get_items().getItem(3).hide();
        }
        else {
            sender.get_appointmentContextMenus()[0].get_items().getItem(3).show();
        }
    }
     
    function timeSlotContextMenu(sender, args) {
        var date = new Date();
        if (args.get_targetSlot().get_startTime() < date) {
            sender.get_timeSlotContextMenus()[0].get_items().getItem(3).hide();
        }
        else {
            sender.get_timeSlotContextMenus()[0].get_items().getItem(3).show();
        }
    }
    <telerik:RadScheduler ID="RadScheduler1" runat="server" OnClientAppointmentsPopulating="OnClientAppointmentsPopulating"
        SelectedView="WeekView" OnClientAppointmentContextMenu="appointmentContextMenu" OnClientTimeSlotContextMenu="timeSlotContextMenu">
        <WebServiceSettings Path="SchedulerWebService.asmx" ResourcePopulationMode="ServerSide" />
        <TimeSlotContextMenus>
            <telerik:RadSchedulerContextMenu ID="TimeSlotTSContextMenu1">
                <Items>
                    <telerik:RadMenuItem Text="item1">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="item2">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="item3">
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadSchedulerContextMenu>
        </TimeSlotContextMenus>
        <AppointmentContextMenus>
            <telerik:RadSchedulerContextMenu ID="RadSchedulerAppContextMenu1">
                <Items>
                    <telerik:RadMenuItem Text="item1">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="item2">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="item3">
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadSchedulerContextMenu>
        </AppointmentContextMenus>
    </telerik:RadScheduler>

    I hope this will help!

    Regards,
    Ivana
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 18 Sep 2012 Link to this post

    Hi Ivana,
    Thank you very much for your quick response. In the given solution, you are hiding menu items by Index, is it possible to get item by text and then hide/display it?

    Prava
  5. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 19 Sep 2012 Link to this post

    Hi,
     I had multiple context menus  in an appointment,  and to solve the issue  I had to call hide/show function for each  menu. 

    Thanks for helping. 
    Prava

  6. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 21 Sep 2012 Link to this post

    Hi Prava,

    Thanks for sharing your solution with us. I hope it will be helpful for the community if someone encounters the same issue.

    Regards,
    Ivana
    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.
  7. DENTAL NETWORK
    DENTAL NETWORK avatar
    3 posts
    Member since:
    Feb 2014

    Posted 13 Feb 2015 in reply to Prava kafle Link to this post

    Hi , I'm trying to hide the context menu in the OnClientAppointmentContextMenu event , but i don't find the way to get that. I have found only the way of hide the menu items and disabled the context menu . If you know how hide and show the context menu , por favor share with me .
    Thanks in advanced
  8. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 18 Feb 2015 Link to this post

    Hello,

    My colleague already explained how to achieve such functionality in Hide the context menu in OnClientAppointmentContextMenu forum thread.


    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017