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

AllowEdit / AllowDelete problem

4 Answers 164 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Flemming Rosenbrandt
Top achievements
Rank 1
Flemming Rosenbrandt asked on 16 Oct 2007, 05:58 AM
Hi

Great to see that AllowDelete & AllowEdit was in this SP.

But I can not achieve what I want.

I want to set a series of “system” appointments which cannot be edited or deleted. But overall I want the user to be able to add his/hers own appointments.

So I set the radSchedulers AllowEdit + AllowDelete to “True” – and the series of “system” appointments AllowEdit + AllowDelete to “False”.

But the radSchedulers properties always seems to override the per appointment properties.

I have a generic List of Appointments and bind it to the radscheduler. Everything else works. But after a rebind the radschedulers appointmentcollection defaults to the radschedulers AllowEdit / AllowDelete properties.

Is this the correct behavior?

/Flemming Rosenbrandt

4 Answers, 1 is accepted

Sort by
0
Dimitar Milushev
Telerik team
answered on 16 Oct 2007, 03:08 PM
Hi,

When the Scheduler is rebound, all appointments are recreated and you have to set the AllowEdit / AllowDelete again. The best way to do this is to use the AppointmentDataBound event.

Greetings,
Dimitar Milushev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
jeremy
Top achievements
Rank 1
answered on 17 Oct 2007, 12:13 PM
I too have this problem with a generic list.

protected void RadScheduler1_AppointmentDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
{
foreach (Model.Appointment appointment in appointmentsForSchedule)
{
if (appointment.SystemMemberGuid!=(string)Session["userID"])
{
e.Appointment.AllowDelete=false;
}
}
}

Basically in this code i'm looping through the appointment collection and saying for each appointment in my list, if the guid does not equal the guid in session (which is placed when a user logs in) then allow delete = false.


I figure this way, if you're not the owner of an appointment, then you cannot delete it. This code produces false for all appointments.




0
Peter
Telerik team
answered on 17 Oct 2007, 03:53 PM
Hi Jeremy,

I tested the AlowDelete and AllowEdit properties in similar scenario but everything worked as expected. I suggest you inspect the code which is not related to RadScheduler. Have you tried placing a debugger for the
"e.Appointment.AllowDelete=false; " line?


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
jeremy
Top achievements
Rank 1
answered on 17 Oct 2007, 04:59 PM
Peter,

I resolved the issue.

protected void RadScheduler1_AppointmentDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
{
    foreach (model.appointment appointment in appointments)
    {
        if (appointment.SystemMemberGuid != (string)Session["userID"])
        {
            if ((int)e.Appointment.ID == appointment.ID)
            {
                  e.Appointment.AllowEdit = false;
                  e.Appointment.AllowDelete = false;
            }
        }
    }
}

Peter I think the problem was my appointment object is a custom object so in the debugger the original code was firing BUT I needed to say where the e.Appointment.ID is equal to the custom object appointment.ID then [execute desired code]

Thanks heaps,
Jeremy
Tags
Scheduler
Asked by
Flemming Rosenbrandt
Top achievements
Rank 1
Answers by
Dimitar Milushev
Telerik team
jeremy
Top achievements
Rank 1
Peter
Telerik team
Share this question
or