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

Disable edit dialogue based on appointment category

12 Answers 203 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 27 Jun 2012, 02:12 PM
Is it possible to prevent edit appointment dialogue from opening when the user double clicks on appointment of specific category?

12 Answers, 1 is accepted

Sort by
0
Sergey
Top achievements
Rank 1
answered on 27 Jun 2012, 02:30 PM
I'm using AppointmentEditingEvent and set e.Cancel = true, but the dialogue still pops up.
0
Vladi
Telerik team
answered on 28 Jun 2012, 01:12 PM
Hello Sergey,

To disable dialogs from showing you need to handle the ShowDialog event in RadScheduleView.

More information on this topic in this article.

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sergey
Top achievements
Rank 1
answered on 29 Jun 2012, 06:49 AM
This article describes how to disable all edit dialogs. Is it possible to disable edit dialogs only for jobs of specific category?
0
Vladi
Telerik team
answered on 29 Jun 2012, 12:09 PM
Hello Sergey,

In the ShowDialog event of the RadScheduleView the passed ShowDialogEventArgs e contains all of the appointment class information, you can use that argument to filter the wanted appointment category and set a true value to the Cancel property of that appointment.

Regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sergey
Top achievements
Rank 1
answered on 29 Jun 2012, 01:06 PM
I can't find any of the appointment class information in ShowDialogEventArgs e. Can you tell me which property I should be looking at?
0
Vladi
Telerik team
answered on 02 Jul 2012, 03:05 PM
Hello Sergey,

In the ShowDialog event the passed ShowDialogEventArgs argument contains the property DialogViewModel that could be cast to AppointmentDialogViewModel. That viewModel contains all of the appointment class information which can be used to filter the appointment's category.
 
More detailed information on events in RadScheduleView in this article.

Regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sergey
Top achievements
Rank 1
answered on 03 Jul 2012, 06:38 AM
Thanks!
0
Sergey
Top achievements
Rank 1
answered on 03 Jul 2012, 07:48 AM
Sorry, I still cannot find the appointment category.

AppointmentDialogViewModel has only property Categories, which contains a list of two categories, none of which is correct one. 

It does work, for example, in the AppointmentEditing event, where AppointmentEditingEventArgs argument contains the property Appointment, which has the property Category which always contains correct appointment category no matter which appointment I double click.
0
Sergey
Top achievements
Rank 1
answered on 06 Jul 2012, 01:58 PM
Anyone have any ideas? Should I submit a ticket?
0
Accepted
Vladi
Telerik team
answered on 09 Jul 2012, 11:31 AM
Hi Sergey,

Here is sample code representing the ShowDialog event handler that cancels the ShowDialog for appointments with Blue Category:

private void RadScheduleView_ShowDialog(object sender, Telerik.Windows.Controls.ShowDialogEventArgs e)
{
    var viewModel = e.DialogViewModel as AppointmentDialogViewModel;
    var currentAppointment = viewModel.Occurrence.Appointment as Task;
 
    if ((currentAppointment.Category != null) && (currentAppointment.Category.CategoryName == "Blue Category"))
    {
        e.Cancel = true;
    }
}

Hope this helps.

Kind regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sergey
Top achievements
Rank 1
answered on 09 Jul 2012, 12:28 PM
Aha, so it was Occurrence property! Thanks!
0
Sandi Markon
Top achievements
Rank 1
answered on 16 Jul 2012, 11:11 AM
You could also add "e.Handled = true" to your original attempt, Sergey, and it also shouldn't open up the dialog (it works in my case).
Tags
ScheduleView
Asked by
Sergey
Top achievements
Rank 1
Answers by
Sergey
Top achievements
Rank 1
Vladi
Telerik team
Sandi Markon
Top achievements
Rank 1
Share this question
or