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

Disable Context Menu.

1 Answer 100 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Timothy Kruszewski
Top achievements
Rank 1
Timothy Kruszewski asked on 10 Jan 2011, 08:44 PM
For security reasons I need to disable the right click option for the context menus but have been unsuccessful with the code samples I've used.  I've tried to disable it via client side scripting and server side scripting and neither option has worked.  If there is a server side solution for this could you please point me in the right direction to finding it?

Thanks



<script type="text/javascript">
        // Dynamic positioning override - not guaranteed to work in future versions!
        $telerik.$.popupDialog.prototype._positionForm = function () {
            // This will be called each time the form needs to be repositioned
            var $ = $telerik.$;
            $(this._targetElement).css({ top: "150px", left: "200px" });
        }
  
        function OnClientAppointmentContextMenu(sender, args) {
            sender.get_appointmentContextMenus()[0].set_enabled(false);
        }   
  
    </script>

protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
   {
       //if (!SecurityHandler.CanWrite(SafeValue.SafeInt(Session["UserID"].ToString()), "Scheduler Admin"))
           e.TimeSlot.CssClass = "Disabled";
   }

1 Answer, 1 is accepted

Sort by
0
Brian King
Top achievements
Rank 1
answered on 10 Jan 2011, 10:15 PM
Hi Timothy, I was actually trying to do this a couple days ago. What I ended up doing was checking in the Appointment databind event to check and see if I wanted to disable the context menu for that appointment. If I did I set the context menu Id of the appointment.
e.Appointment.ContextMenuID = "NoMenu";

The on the aspx page I define NoMenu to be this:
<telerik:RadSchedulerContextMenu runat="server" ID="NoMenu">
</telerik:RadSchedulerContextMenu>

Not the prettiest solution, but when I was looking through their documentation it had said that even on the client side the event wasn't able to be canceled, so this is the best workaround I could find.
Tags
Scheduler
Asked by
Timothy Kruszewski
Top achievements
Rank 1
Answers by
Brian King
Top achievements
Rank 1
Share this question
or