Custom context menu item and recurring appointments

12 posts, 0 answers
  1. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 10 Apr 2011 Link to this post

    Hi Guys,

    So I have a custom context menu item I added to the right click menu of the appointments. My client has several recurring appoints they put on their schedule as placeholders that they want to then later be able to assign customers to. Easy enough on a non-recurring appointment like so:

    if (e.MenuItem.Value == "CommandSelectClient") {
                Response.Redirect("browse_clients.aspx?go=appointments.aspx&m=select&appointment_id=" + e.Appointment.ID.ToString());
            }

    But, the problem comes when I try do it on a recurring event  which is the whole point of this exercise. It passes the recurring event ID through the above URL.

    How can I convert the recurring appointment to a non-recurring appointment in this event handler, and then get the non recurring ID passed across to my new page?

    Thanks!
  2. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 12 Apr 2011 Link to this post

    Any update? Thanks :)
  3. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 13 Apr 2011 Link to this post

    Hi Mitchell,

    The recurrence rule is stored in a single appointment (especially useful when you have to deal with abstractions such as infinity). In order to pass a unique identifier for any appointment to your other page, you can still pass the AppointmentId, but in combination with the StartTime of the appointment.


    Regards,
    Nikolay Tsenkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  4. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 13 Apr 2011 Link to this post

    That doesn't help too much. Can you clarify?

    When I pass the appointment ID of a recurring appointment, it's coming across in a strange format, IE, 607_0, instead of just 607. I need to drop the recurrence rule when the command is executed and only get the single appointment ID (IE, 607)

    Thoughts?
  5. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 18 Apr 2011 Link to this post

    Can someone please help with this?
  6. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 18 Apr 2011 Link to this post

    Hi Mitchell,

    You can split the string and get just the first returned item. Something like the following:
    // this should get '607' out of '607_0', and at the
    // same time it should get '607' out of '607'
    string aptID = receivedAptID.Split('_')[0];


    Regards,
    Nikolay Tsenkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 18 Apr 2011 Link to this post

    That makes sense, but then if I do that, how do I convert that instance of the recurring appointment into a single appointment, while retaining the original series in the other days for that time slot?

    IE, if I have a recurring appointment that goes every day at 10AM, I would want to make tuesday's into a regular appointment using the right click menu item I talked about below.
  8. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 21 Apr 2011 Link to this post

    Hi Mitchell,

    You can turn the occurrence in a separate appointment if you make it as exception to the recurrence rule of the RecurrenceMaster appointment.
    You can achieve this using the following:
    // with this method a RecurrenceException appointment is created
    var apt = RadScheduler1.PrepareToEdit(occurence, false);
     
    //... any editing of the appointment goes here
    // for example you can edit the subject: apt.Subject = apt.Subject + " x";
    //...
     
    // here the RecurrenceException is being added to the recurrence rule
    // and an actual appointment is created and saved in the source
    RadScheduler1.UpdateAppointment(apt);


    Regards,
    Nikolay Tsenkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  9. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 24 Apr 2011 Link to this post

    That appears to be client side code. How could I get that same result from the AppointmentContextMenuItemClicked on the server side code?
  10. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 24 Apr 2011 Link to this post

    I'm at little closer.. I was able to get it to work under server side code:

    Appointment a = radAppointmentsDoctors.PrepareToEdit(e.Appointment, false);
    radAppointmentsDoctors.UpdateAppointment(a);

    But I can't seem to get the new ID number without re-databinding the schedule. Can you advise how I can get a handle on the new ID number?

  11. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 25 Apr 2011 Link to this post

    I came up with a temporary(!) solution. I still really need to know how to generate a new ID number for the recurrence exception within the command procedure.

    In the meantime, I made a "get new id" function that gets the MAX(id) From the appointments table, which in a "quiet" application will be ok, but in a busy office, that isn't safe.

    CURRENT SOLUTION:
    if (e.MenuItem.Value == "CommandSelectClient") {
                Appointment a = radAppointmentsDoctors.PrepareToEdit(e.Appointment, false);
                radAppointmentsDoctors.UpdateAppointment(a, e.Appointment);
                
                Response.Redirect("browse_clients.aspx?go=appointments.aspx&m=select&appointment_id=" + bvAppointmentDoctor.getNewID());
            }

    PREFERRED SOLUTION:

    if (e.MenuItem.Value == "CommandSelectClient") {
                Appointment a = radAppointmentsDoctors.PrepareToEdit(e.Appointment, false);
                radAppointmentsDoctors.UpdateAppointment(a, e.Appointment);

    // GET NEW ID HERE SOMEHOW!
                
                Response.Redirect("browse_clients.aspx?go=appointments.aspx&m=select&appointment_id=" + new_id);
            }

    I know if I do a select * on the appointments table right after UpdateAppointment is called, the new ID is there.. but the scheduler isn't aware of it yet.

    Thanks for any help
  12. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Apr 2011 Link to this post

    Hi Mitchell,

    Thank you for sharing your findings with us.

    We don't have any ideas for the moment, but if we can think of some workaround, we will follow up and let you know.

    Best wishes,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top