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

making resource a mandatory field

3 Answers 84 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Kerry
Top achievements
Rank 1
Kerry asked on 15 Oct 2013, 05:31 AM
Hello,

I read of someone removing the (none) and (any) options from the resources dropdown on the AppointmentEdit form, what I like is to keep (none) and if the user does not select a resource other than (none) prompt the user to select a valid resource.  I was trying the ApplySettingsToEvent method and it does not look to be firing when I close the Apppointment edit form.  Using VS2008 RadScheduler 2012.1.321.20 .

Thanks

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 17 Oct 2013, 04:06 PM
Hi Kerry,

Thank you for contacting us.

In your case the best choice seems to be to create a custom EditAppointmentDialog:
public class MyEditAppointmentDialog : EditAppointmentDialog
{
    private bool canceled;
 
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
 
        this.buttonCancel.MouseDown += ButtonCancel_MouseDown;
    }
 
    void ButtonCancel_MouseDown(object sender, MouseEventArgs e)
    {
        canceled = true;
    }
 
    protected override void OnClosing(CancelEventArgs e)
    {
        base.OnClosing(e);
        if (this.cmbResource.SelectedItem.Text == "None" && !canceled)
        {
            e.Cancel = true;
            MessageBox.Show("Select a different value");
        }
 
        canceled = false;
    }
}

You can use it in the AppointmentEditDialogShowing event of RadScheduler:
void scheduler_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
{
    e.AppointmentEditDialog = new MyEditAppointmentDialog();
}

With this dialog whenever one tries to leave the form with a selected resource "None" he will not be able to, unless the cancel button is pressed.

I hope this helps.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Vijay
Top achievements
Rank 1
answered on 30 Oct 2013, 12:08 AM
PLEASE IGNORE MY POST BELOW. NOT SURE WHAT CHANGED BUT IS WORKING. THANKS.

I used the code you have provided below to check if a control in my appointment dialogue is populated or not. If it is not I cancel the closing using e.Cancel in the OnClosing event function.

However, I have found the following. Once the event is cancelled, the OnClosing event does not fire subsequently (fires once only) if the Cancel button is selected. When I say does not fire, it does not even reach the break point I have placed in the beginning of the OnClosing function.

Please help.

Thanks,
Vijay
0
George
Telerik team
answered on 01 Nov 2013, 04:43 PM
Hello Vijay,

I am glad that you resolved your issue.

Let me know if I can be of further assistance.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Scheduler and Reminder
Asked by
Kerry
Top achievements
Rank 1
Answers by
George
Telerik team
Vijay
Top achievements
Rank 1
Share this question
or