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

Add Appointments Programatically

1 Answer 53 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jugoslav
Top achievements
Rank 1
Jugoslav asked on 16 Sep 2011, 11:15 PM
How do i add appointments from within code-behind. Something like the following:

Dim startdate As DateTime = DateTime.Parse("9/16/2011")
        For i As Integer = 1 To 12
            startdate = startdate.AddMonths(1)
            ' pseudo code:
                  MyScheduler.Appointments.Add(startdate)
        Next

Meaning, no source code (database, generic list etc. etc.). Just a simple loop.

Thank you

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 19 Sep 2011, 11:48 AM
Hello Jugoslav,

I have answered to your question in the support ticket you have sent.
For your convenience the answer to your question cold also be found here.

In respect to your question:

I have made an example for you showing how appointments could be added server-side.
I have used a button that makes a post-back to the server and in its OnClick event handler I add appointments to the scheduler.

Here is the example:
Copy Code
Protected Sub Button1_Click(sender As [Object], args As EventArgs)
    For counter As Integer = 1 To 3
        Dim start As DateTime = DateTime.Now.ToUniversalTime()
        start = start.AddHours(counter)
        Dim [end] As DateTime = start.AddHours(1)
        Dim apt As New Appointment(counter.ToString(), start, [end], "Subject of appointmenrt_" & counter.ToString())
        RadScheduler1.InsertAppointment(apt)
    Next
    RadScheduler1.Rebind()
End Sub

I hope this would help you.

Regards,
Ivana
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
Jugoslav
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or