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

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

7 Answers 329 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Chandan Kumar
Top achievements
Rank 1
Chandan Kumar asked on 27 May 2010, 02:23 PM
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 

7 Answers, 1 is accepted

Sort by
0
Chip
Top achievements
Rank 1
answered on 28 May 2010, 02:01 PM
I guess you can disable the menu items in the OnAppointmentContextMenu client-side event - http://www.telerik.com/help/aspnet-ajax/schedule_clientsideonclientappointmentcontextmenu.html
0
Chandan Kumar
Top achievements
Rank 1
answered on 28 May 2010, 03:08 PM
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

0
Peter
Telerik team
answered on 28 May 2010, 03:42 PM
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.
0
Chandan Kumar
Top achievements
Rank 1
answered on 29 May 2010, 06:43 AM
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
0
Peter
Telerik team
answered on 01 Jun 2010, 02:42 PM

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.
0
walid
Top achievements
Rank 1
answered on 13 Oct 2015, 09:21 AM

hi,

this function don't disable a timeSlotMenu

 

0
Nencho
Telerik team
answered on 16 Oct 2015, 07:51 AM
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
Tags
Scheduler
Asked by
Chandan Kumar
Top achievements
Rank 1
Answers by
Chip
Top achievements
Rank 1
Chandan Kumar
Top achievements
Rank 1
Peter
Telerik team
walid
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or