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

Readonly appointment

5 Answers 212 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Li Zhou
Top achievements
Rank 1
Li Zhou asked on 08 Jul 2010, 11:35 PM
I am wondering what is the easiest way to set an appointment readonly?
Some of the appointments for example, supervisor's assignment to employee, once set in the scheduler, one cannot delete and update them.  How could I achieve it?  I hope there is  a readonly property for Appointment class. 

Thanks

BTW, no one has answers to my other questions:
http://www.telerik.com/community/forums/aspnet-ajax/scheduler/scheduler-performance-concerns.aspx
http://www.telerik.com/community/forums/aspnet-ajax/scheduler/user-based-recources.aspx

5 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 14 Jul 2010, 04:24 PM
Hi Li Zhou,

To be able to make a SchedulerAppointment  readonly you'll need to get the client object of the appointment and set these two properties to false:

set_allowEdit() - sets a Boolean value indicating whether the Appointment can be edited.

set_allowDelete() - sets a Boolean value indicating whether the Appointment can be deleted.

The alternatives server-side are AllowEdit and AllowDelete.

P.S : Tsvetomir answered to your two posts.

Best wishes,
Veronica Milcheva
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
Li Zhou
Top achievements
Rank 1
answered on 14 Jul 2010, 04:54 PM
Thanks for the reply.
I tried AllowEdit and AllowDelete on the server side.  But After I set them to false on the server side, I can still see the delete icon and Edit context menu.  Since I used Web service binding, I can still delete/edit from the UI,  even though it does not go through in the server side.

I have to subscribe client side events such as OnClientAppointmentDeleteing, OnClientAppointmentMoveEnd, OnClientAppointmentResizeEnd to prevent it from modifing the appoinment.

Overall I have acheive the "readonly", but not as easy as just set the AllowEdit/AllowDelete property.
Am I missing anything simple?
0
smith spd
Top achievements
Rank 1
answered on 14 Jul 2010, 09:17 PM
The best way to achieve read only is to disable the "Save" button inside the appointment template which can be done the following way.

If you have data in the appointment use the below code


 

protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)

 

{

 

if (((e.Container.Mode == SchedulerFormMode.AdvancedEdit)))

 

{

 

LinkButton cmdUpdate = (LinkButton)e.Container.FindControl("UpdateButton");

 

cmdUpdate.Visible =

false;

 

}

}



If you want the new appointment to be read only then..use the below code..

 

protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)

 

{

 

if (e.Mode == SchedulerFormMode.AdvancedInsert)

 

{

e.Cancel =

true;

 

}

}


Hope this helps.

Smith

0
pavan
Top achievements
Rank 1
answered on 14 Sep 2010, 04:15 PM
i tried this. This is not working. I need to set 'ReadOnly' property of appointment on Server Side.
can any one please reply for this.
0
Veronica
Telerik team
answered on 16 Sep 2010, 02:03 PM
Hello pavan,

As you are using the Web Service binding  OnFormCreated and OnFormCreating server-side events will not work.

Unfortunately at this moment we don't have ReadOnly property for appointment.

One way to make the appointment readonly is to subscribe to the OnAppointmentEditing and OnAppointmentDeleting, OnClientAppointmentMoveEnd and OnClientAppointmentResizeEnd events and cancel them.

function appointmentDeleting(sender, args) {
    args.set_cancel(true);
}

The other option on the server is to subcribe to the OnAppointmentCreated event and set AllowDelete and AllowEdit properties to false. Also you need to disable the context menu for the appointment:

protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
    {
        e.Appointment.AllowDelete = false;
        e.Appointment.AllowEdit = false;
    }

<AppointmentContextMenuSettings EnableDefault="false" />

We'll think of creating a ReadOnly property for appointment in future.

Regards,
Veronica Milcheva
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
Tags
Scheduler
Asked by
Li Zhou
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Li Zhou
Top achievements
Rank 1
smith spd
Top achievements
Rank 1
pavan
Top achievements
Rank 1
Share this question
or