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

How can I delete "(Any)" in Scheduler Resources?

7 Answers 219 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
yurinkomarov
Top achievements
Rank 1
yurinkomarov asked on 16 Feb 2016, 11:00 AM

Hi!

 

How can I delete string ("Any") in Scheduler Resources?

This this how I add my own strings

                            for (int i = 0; i < temp.Length; i++)
                            {
                                radDropDownList5.Items.Add(temp[i].ItemArray[3].ToString());
                                Resource resource = new Resource();
                                resource.Id = new EventId(i);
                                resource.Name = temp[i].ItemArray[3].ToString();
                                //resource.Color = colors[i];
                                //resource.Image = this.imageList1.Images[i];
                                MessageBox.Show(temp[i].ItemArray[3].ToString());
                                this.radScheduler1.Resources.Add(resource);
                            }

But I results I see this (attach screenshot)

 

Best regards, Me!

7 Answers, 1 is accepted

Sort by
0
yurinkomarov
Top achievements
Rank 1
answered on 16 Feb 2016, 11:01 AM
Sorry, problems with image name
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Feb 2016, 01:57 PM
Hello Yura,

Thank you for writing.

In order to achieve your goal, you should create a custom EditAppointmentDialog and override the LoadResources method where you can remove the redundant resource item:
 
public Form1()
{
    InitializeComponent();
 
    for (int i = 0; i < 5; i++)
    {
        Resource resource = new Resource();
        resource.Id = new EventId(i);
        resource.Name = "Resource" + i;
        this.radScheduler1.Resources.Add(resource);
    }
 
    this.radScheduler1.AppointmentEditDialogShowing += radScheduler1_AppointmentEditDialogShowing;
}
 
CustomEditAppointmentDialog appointmentDialog = null;
 
private void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
{
    if (this.appointmentDialog == null)
    {
        this.appointmentDialog = new CustomEditAppointmentDialog();
    }
    e.AppointmentEditDialog = this.appointmentDialog;
}
 
public class CustomEditAppointmentDialog : EditAppointmentDialog
{
    protected override void LoadResources()
    {
        base.LoadResources();
        this.cmbResource.Items.RemoveAt(1);
    }
}

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
yurinkomarov
Top achievements
Rank 1
answered on 16 Feb 2016, 04:31 PM

It works, thanks!

 

The next question is "How to create a rule to check for blank fields before saving? Completely rewrite function buttonOK? If so, how?"

 

Best regards, Me!

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Feb 2016, 10:39 AM
Hello Yura,

Thank you for writing back. 

When the OK button in the EditAppointmentDialog is clicked, RadScheduler performs data validation. However, if you need to introduce any additional validation you can override the ValidateInput method in the custom EditAppointmentDialog:
public class CustomEditAppointmentDialog : EditAppointmentDialog
{
    protected override bool ValidateInput()
    {
        bool baseResult = base.ValidateInput();
        //TODO
        return baseResult;
    }
}

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
yurinkomarov
Top achievements
Rank 1
answered on 18 Feb 2016, 10:26 AM

Do not quite understand.

I need this class to register in the basic form, which the scheduler is? Or in the Custom AppointmentEditForm?

Best regards, Me!

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Feb 2016, 12:21 PM
Hello Yura,

Thank you for writing back. 
 
As it was demonstrated in my initial reply, you can subscribe to the RadScheduler.AppointmentEditDialogShowing event and replace the default EditAppointmentDialog with your custom one. In the descendant of the EditAppointmentDialog, you can override the ValidateInput method and add the desired blank fields check. Thus, when the OK button is clicked and the validation is not successful, the changes will not be applied to the associated Appointment.

In the following help article, it is demonstrated a complete example of creating a custom edit dialog: http://docs.telerik.com/devtools/winforms/scheduler/appointments-and-dialogs/adding-a-custom-field-to-the-editappointment-dialog

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
yurinkomarov
Top achievements
Rank 1
answered on 18 Feb 2016, 12:32 PM

Thanks. Everything is OK

 

Best regards, Me!

Tags
Scheduler and Reminder
Asked by
yurinkomarov
Top achievements
Rank 1
Answers by
yurinkomarov
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or