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