
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

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.
Dess
Telerik

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!
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 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!
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

Thanks. Everything is OK
Best regards, Me!