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

Obtain the last appointment ID

5 Answers 63 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Danilo
Top achievements
Rank 1
Danilo asked on 03 Mar 2011, 11:41 AM
Hi all,
how to obtain the ID of the  just created appointment?
Thank's
Danilo

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 03 Mar 2011, 03:25 PM
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!
0
Danilo
Top achievements
Rank 1
answered on 03 Mar 2011, 06:00 PM
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

0
Peter
Telerik team
answered on 04 Mar 2011, 04:59 PM

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!
0
Nayan
Top achievements
Rank 1
answered on 13 Jun 2011, 07:57 PM
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.
0
Peter
Telerik team
answered on 16 Jun 2011, 07:14 PM
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.

Tags
Scheduler
Asked by
Danilo
Top achievements
Rank 1
Answers by
Peter
Telerik team
Danilo
Top achievements
Rank 1
Nayan
Top achievements
Rank 1
Share this question
or