Validation for AdvancedEditTemplate

8 posts, 0 answers
  1. Kati
    Kati avatar
    46 posts
    Member since:
    Oct 2012

    Posted 08 Feb 2010 Link to this post

    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

     

  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 08 Feb 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 08 Feb 2010 Link to this post

    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.
  5. Kati
    Kati avatar
    46 posts
    Member since:
    Oct 2012

    Posted 10 Feb 2010 Link to this post


  6. Kati
    Kati avatar
    46 posts
    Member since:
    Oct 2012

    Posted 10 Feb 2010 Link to this post

    Sorry, ignore my previous post.
    How do I get back a custom attribute value in  RadScheduler1_AppointmentUpdate please?
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 10 Feb 2010 Link to this post

    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.
  8. Kati
    Kati avatar
    46 posts
    Member since:
    Oct 2012

    Posted 10 Feb 2010 Link to this post

    Yes
    I'm getting this error

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


    Kati
  9. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 11 Feb 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017