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

Validation for AdvancedEditTemplate

7 Answers 96 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kati
Top achievements
Rank 1
Kati asked on 08 Feb 2010, 04:17 PM
I am using an AdvancedEditTemplate. When the user clicks on the 'Update' button, RadScheduler1_AppointmentCommand gets called. Here I am validating the fields. The screen will go back to the origianl calendar grid view, no matter what. I really need to keep the user on the edit for view, if the validation fails and show them a message. This way the appointment doe not get save, but the user doesn't know what's happening. Any way of doing this?

Thanks a lot

Kati

 

7 Answers, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 08 Feb 2010, 05:37 PM
The Scheduler control doesn't have the KeepInEditMode property like the Grid control does so it's not a built-in feature.

A good work-around should be something like this:

-- perform validation

// check if validation failed
if (!valid)
{
// cancel the event
e.Cancel = true;
// show the edit form again for the appointment
scheduler.ShowAdvancedEditForm(e.Appointment)
-- show message
}

The code above is assuming you're using the AppointmentInsert/AppointmentUpdate events, since they can be canceled.

I hope that helps.
0
robertw102
Top achievements
Rank 1
answered on 08 Feb 2010, 05:39 PM
If you're using the edit mode you can replace e.Appointment with e.ModifiedAppointment, so that it retains any of the changes they might have made. I haven't tried it out, but I'm assuming it will work.
0
Kati
Top achievements
Rank 1
answered on 10 Feb 2010, 10:51 AM

0
Kati
Top achievements
Rank 1
answered on 10 Feb 2010, 10:56 AM
Sorry, ignore my previous post.
How do I get back a custom attribute value in  RadScheduler1_AppointmentUpdate please?
0
Peter
Telerik team
answered on 10 Feb 2010, 01:51 PM
Hi Kati,

Have you tried e.Appointment.Attributes["MyCustomAttribute"]?

Kind regards,
Peter
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Kati
Top achievements
Rank 1
answered on 10 Feb 2010, 03:00 PM
Yes
I'm getting this error

  e.ModifiedAppointment.Attributes["txtNotes"] is null   


Kati
0
robertw102
Top achievements
Rank 1
answered on 11 Feb 2010, 03:57 PM
It's returning null because I don't think the ModifiedAppointment object retains the attributes set in the Appointment object. You would need to get the attribute from the Appointment object.
Tags
Scheduler
Asked by
Kati
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
Kati
Top achievements
Rank 1
Peter
Telerik team
Share this question
or