Obtain the last appointment ID

6 posts, 0 answers
  1. Danilo
    Danilo avatar
    14 posts
    Member since:
    Jan 2011

    Posted 03 Mar 2011 Link to this post

    Hi all,
    how to obtain the ID of the  just created appointment?
    Thank's
    Danilo
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 03 Mar 2011 Link to this post

    Hi Danilo,

    I am not sure what exactly you need to achieve, but here is one possible solution:
    protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
       {
           ViewState["LastAppointmentID"] = e.Appointment.ID.ToString();
       }
       protected void RadScheduler1_DataBound(object sender, EventArgs e)
       {
           Response.Write(ViewState["LastAppointmentID"]);
       }


    Best wishes,
    Peter
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Danilo
    Danilo avatar
    14 posts
    Member since:
    Jan 2011

    Posted 03 Mar 2011 Link to this post

    Hi Peter,
    sorry, you're right.
    I'm creating an appointment with a button. On the button_click, i call this code to create an appointment

     

    DateTime aptStart = RadScheduler1.DisplayToUtc(DateTime.Now.AddMinutes(1));

     

     

     

    Appointment apt = new Appointment(null, aptStart, aptStart.AddMinutes(2), "Appointment with reminder");

     

     

    apt.Reminders.Add(

    new Reminder(1));

     

    RadScheduler1.InsertAppointment(apt);

    The selected date of the  RadScheduler is set one year before, so the Appointment_Created never fire. Then i can't use your code.
    There is another way to recover the just inserted appointment id?
    Thank's
    danilo

  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 04 Mar 2011 Link to this post


    Good point. It is better to use AppointmentDataBound instead of AppointmentCreated as the former will fire even for appointments that are not within the visible range of RadScheduler.

    All the best,
    Peter
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  5. Nayan
    Nayan avatar
    7 posts
    Member since:
    Apr 2011

    Posted 13 Jun 2011 Link to this post

    Hello Peter,
    Following some of the responses you wrote, seems like you know what you are talking about. I have an urgent need that I posted and have not received any responses yet. i was wondering if you could please help me.
    Here is the url for the post :

    http://www.telerik.com/community/forums/aspnet-ajax/scheduler/radscheduler-with-stored-procedures.aspx

    Thank you.
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 16 Jun 2011 Link to this post

    Hi Nayan,

    Could you please open a new forum thread or a support ticket, because for some reason I cannot open the url you provided?

    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