How to Hide Context Menu with Particular Given Appointment And Time Slot

8 posts, 0 answers
  1. Chandan Kumar
    Chandan Kumar avatar
    68 posts
    Member since:
    Mar 2010

    Posted 27 May 2010 Link to this post

    Dear Sir,

    I am using Rad Scheduler Control. I have given right Click Contect menu Facility in Given Appointment For Edit.
    Also i have given new appointment Contect Menu in blank time Slot.

    Its Working Fine.

    But i want to hide these menu condition wise.

    Like When Appointment status is DEACTIVE Then there is no Option of right click means there is no option when i r do right click.

    Same as in case of New Appointment. i want 5 to 6 o'clock no option of right click and other time right click is working.

    How can i achive. Please help me.

    My Aspx File Code:-
     

     

     

     

    <telerik:RadScheduler AllowInsert="false" HoursPanelTimeFormat="hh:mm tt" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"

     

     

     

     

     

    OnAppointmentCreated="RadScheduler1_AppointmentCreated" runat="server" ID="RadScheduler1"

     

     

     

     

     

    Skin="Office2007" Height="545px" CustomAttributeNames="StatusId" Width="690px"

     

     

     

     

     

    ShowFooter="false" SelectedDate="2010-03-18" DayStartTime="07:00:00" DayEndTime="21:00:00"

     

     

     

     

     

    FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" EnableDescriptionField="true"

     

     

     

     

     

    ShowNavigationPane="false" OnAppointmentDelete="RadScheduler1_AppointmentDelete"

     

     

     

     

     

    DataSubjectField="Subject" DataStartField="FromTime" DataEndField="ToTime" ShowAllDayRow="false"

     

     

     

     

     

    AllowEdit="false" DataKeyField="AppointmentId" DataDescriptionField="StatusColor" OnTimeSlotContextMenuItemClicked="RadScheduler1_TimeSlotContextMenuItemClicked"

     

     

     

     

     

    AllowDelete="false" OnAppointmentContextMenuItemClicked="RadScheduler1_AppointmentContextMenuItemClicked"

     

     

     

     

     

    OnNavigationCommand="RadScheduler1_NavigationCommand" OnTimeSlotCreated="RadScheduler1_TimeSlotCreated">

     

     

     

     

     

    <AppointmentContextMenuSettings EnableDefault="false" />

     

     

     

     

     

    <TimelineView UserSelectable="false" />

     

     

     

     

     

     

     

    <AppointmentTemplate>

     

     

     

     

    <%

    # Eval("Subject")%>

     

     

    <br />

     

     

     

     

     

    <asp:Label runat="server" ID="Teacher" />

     

     

     

     

     

    <br />

     

     

     

     

     

    <asp:Label runat="server" ID="Students" />

     

     

     

     

     

    </AppointmentTemplate>

     

     

     

     

     

    <AppointmentContextMenus>

     

     

     

     

     

    <telerik:RadSchedulerContextMenu runat="server" DataTextField="Status" DataValueField="StatusId"

     

     

     

     

     

    ID="SchedulerAppointmentContextMenu" AppendDataBoundItems="true">

     

     

     

     

     

    <Items>

     

     

     

     

     

    <telerik:RadMenuItem Text="Copy" Value="Copy" />

     

     

     

     

     

    <telerik:RadMenuItem IsSeparator="True" />

     

     

     

     

     

    <telerik:RadMenuItem Text="Edit" Value="Edit" />

     

     

     

     

     

    <telerik:RadMenuItem IsSeparator="True" />

     

     

     

     

     

    </Items>

     

     

     

     

     

    </telerik:RadSchedulerContextMenu>

     

     

     

     

     

    </AppointmentContextMenus>

     

     

     

     

     

    <TimeSlotContextMenus>

     

     

     

     

     

    <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerTimeSlotContextMenu">

     

     

     

     

     

    <Items>

     

     

     

     

     

    <telerik:RadMenuItem Text="New Appointment" Value="New" />

     

     

     

     

     

    <telerik:RadMenuItem IsSeparator="true" />

     

     

     

     

     

    <telerik:RadMenuItem Text="Paste" Value="Paste" />

     

     

     

     

     

    </Items>

     

     

     

     

     

    </telerik:RadSchedulerContextMenu>

     

     

     

     

     

    </TimeSlotContextMenus>

     

     

     

     

     

    <TimeSlotContextMenuSettings EnableDefault="False" />

     

     

     

     

     

    </telerik:RadScheduler>

     

     

     

    My Cs Page Code:-

    Page Load ()
    {


     

    if

     

    (ds.Tables[0].Rows.Count > 0)

     

    {

    RadScheduler1.SelectedDate = CalApp.SelectedDate;

    RadScheduler1.DayStartTime =

    TimeSpan.Parse(ds.Tables[0].Rows[0].ItemArray[0].ToString());

     

    RadScheduler1.DayEndTime =

    TimeSpan.Parse(ds.Tables[0].Rows[0].ItemArray[1].ToString());

     

     

    RadScheduler1.MinutesPerRow =

    int.Parse(ds.Tables[0].Rows[0].ItemArray[2].ToString());

     

    RadScheduler1.TimeLabelRowSpan = 60 /

    int.Parse(ds.Tables[0].Rows[0].ItemArray[2].ToString());

     

    RadScheduler1.DataKeyField =

    "AppointmentId";

     

    RadScheduler1.DataStartField =

    "FromTime";

     

    RadScheduler1.DataEndField =

    "ToTime";

     

    RadScheduler1.DataSubjectField =

    "Subject";

     

    RadScheduler1.GroupBy =

    "Resource";

     

     

     

     

     

    RadScheduler1.ResourceTypes.Clear();

     

    ResourceType rt = new ResourceType("Resource");

     

    rt.DataSource = ds.Tables[2];

    rt.KeyField =

    "ResourceId";

     

     

    if (ddlFacility.SelectedValue == "0")

     

    {

    rt.ForeignKeyField =

    "FacilityId";

     

    }

     

    else

     

     

     

     

    {

    rt.ForeignKeyField =

    "DoctorId";

     

    }

    rt.TextField =

    "ResourceName";

     

    RadScheduler1.ResourceTypes.Add(rt);

     

    RadScheduler1.DataSource = ds.Tables[1];

    RadScheduler1.DataBind();

    lblFacility.Text = ddlFacility.SelectedItem.Text;

     

     

     

     

     

    }

     

     

    else

     

     

     

     

    {

     

     

     

     

     

     

    Alert.ShowAjaxMsg("There is no time define in selected provider and facility.", Page);

     

     

     

     

     

     

    }

     


     

    DataSet

     

    Statusdt = new DataSet();

     

    Statusdt = GetAppointmentStatus();

    SchedulerAppointmentContextMenu.DataSource = Statusdt;

    SchedulerAppointmentContextMenu.DataBind();

     

    }


     

    DataSet

     

    GetAppointmentStatus()

     

    {

     

    DataSet ds = new DataSet();

     

     

    Hashtable HashIn = new Hashtable();

     

    DAL.

    DAL dl = new DAL.DAL(DAL.DAL.DBType.SqlServer, sConString);

     

     

    DataSet Reasondt = new DataSet();

     

    Reasondt = dl.FillDataSet(

    CommandType.Text, "Select * From AppointmentStatus(" + Session["HospitalLocationID"] + ")" );

     

     

     

    return Reasondt;

     

    }

     








    Thanks
    Chandan 

  2. Chip
    Chip avatar
    22 posts
    Member since:
    Feb 2006

    Posted 28 May 2010 Link to this post

    I guess you can disable the menu items in the OnAppointmentContextMenu client-side event - http://www.telerik.com/help/aspnet-ajax/schedule_clientsideonclientappointmentcontextmenu.html
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chandan Kumar
    Chandan Kumar avatar
    68 posts
    Member since:
    Mar 2010

    Posted 28 May 2010 Link to this post

    Sir i want to disable right click menu on particular cell of Rad scheduler control.

    Can u help me.

    Acctully i have give appointment through context menu. and i want to disable right click menu on particular cell of rad scheduler control. then user can't give appointment in blocked cell of scheduler.

    So please help me.

    Thank You

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 May 2010 Link to this post

    Hi Chandan,

    We have recently updated this kb article to include the functionality that you want. The code of interest is:

    function pageLoad() { 
                $telerik.$(".Disabled").bind("contextmenu", function (e) { 
                    return false;              
                }); 
            


    Greetings,
    Peter
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  6. Chandan Kumar
    Chandan Kumar avatar
    68 posts
    Member since:
    Mar 2010

    Posted 29 May 2010 Link to this post

    Please give me server side code for disable particular cell's Context menu with Condition wise.
    Because i need disable context menu from paticular cell with condition wise.

    for example :-

    In one Scheduler i just showing 2 Doctor Time Schedule in two column.

    and i am giveing appointment by context menu "New Appointment". 

    if doctor A lunch time is 12:00 to 12:30  and 
    Doctor B  Lunch time Is 1:00 to 1:30 .

    Then i want do not appear context menu on Cell  12:00 to 12:30   for docater A
    and  1:00 to 1:30  for Doctor B. Because these time is lunch time of both doctor.

    i think you understand my condition. please help me.

    Thank You.
    Chandan
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 01 Jun 2010 Link to this post


    The kb article suggests a server side solution since the CssClass property of the time slot is set to "Disabled" in TimeSlotCreated:

    protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)   
        {   
            if(myCondition)
                    e.TimeSlot.CssClass = "Disabled";   
              
        }   


    Best wishes,
    Peter
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  8. walid
    walid avatar
    3 posts
    Member since:
    Jul 2015

    Posted 13 Oct 2015 in reply to Peter Link to this post

    hi,

    this function don't disable a timeSlotMenu

     

  9. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 16 Oct 2015 Link to this post

    Hello walid,

    Actually, after some local tests, this functionality is properly working (preventing the menu to show up), using the approach, demonstrated in this thread.

    Please handler the TimeSlotCreated event of the RadScheduler and use the approach at the pageLoad to cancel the menu showing for the slot with the specific disabled class as demonstrated below:

    protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)  
        {  
            if(myCondition)
                    e.TimeSlot.CssClass = "Disabled";  
               
        }

    function pageLoad() {
                $telerik.$(".Disabled").bind("contextmenu", function (e) {
                    return false;             
                });
            }


    Regards,
    Nencho
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017