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

Recurring appointment only showing once in my databound scheduler

4 Answers 77 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Bex
Top achievements
Rank 1
Bex asked on 16 Feb 2012, 05:30 PM
Hi

I am new to Telerik and I am working with the scheduler and want recurring appointments.
I am using the standard advanced insert and then hooking into the oninsert event and adding them to the database but I am only seeing the appointment once in the scheduler.
I have found in the forum about the \r\n for the new lines and have tried adding this but it doesn't seem to make any difference but can't seem to find anything else.

Can anyone see what I am doing wrong?

I am adding appointments like this:

protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
       {
           //add the new appointment to the db
 
           int? recurrentParentId = null;
           if (e.Appointment.RecurrenceParentID != null) recurrentParentId = (int)e.Appointment.RecurrenceParentID;
           AppointmentManager.AddUserAppointment(
               UserId,
               1,
               e.Appointment.Start,
               e.Appointment.End,
               e.Appointment.RecurrenceRule,
               recurrentParentId,
               e.Appointment.Description,
               e.Appointment.Subject);
           BindSchedule();
       }


I am then binding the scheduler like this:
mySchedule.DataSource = GetSchedule(); //calls the database and gets the appointments
mySchedule.DataBind();

This is my scheduler markup is:
<telerik:RadScheduler runat="server" ID="mySchedule" DayStartTime="08:00:00" DayEndTime="22:00:00"
    StartInsertingInAdvancedForm="true" ShowNavigationPane="true" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
    OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
    DataKeyField="AppointmentId" DataSubjectField="Subject" DataDescriptionField="Description"
    DataStartField="Start" DataEndField="EndX" DataRecurrenceField="RecurrenceRule"
    DataRecurrenceParentKeyField="RecurrenceParentId" FirstDayOfWeek="Monday" ShowHeader="true"
    ShowFooter="false">
    <AdvancedForm Modal="true" />
    <DayView UserSelectable="false" />
    <WeekView UserSelectable="false" />
    <MonthView UserSelectable="false" />
    <TimeSlotContextMenuSettings EnableDefault="true" />
    <AppointmentContextMenuSettings EnableDefault="true" />
    <ResourceTypes>
        <telerik:ResourceType KeyField="ID" Name="Type" TextField="Keyword" ForeignKeyField="AppointmentTypeID"
            DataSourceID="AppointmentTypesDataSource" />
    </ResourceTypes>
    <ResourceStyles>
        <telerik:ResourceStyleMapping Type="Type" Text="Event" ApplyCssClass="rsCategoryGreen" />
                <telerik:ResourceStyleMapping Type="Type" Text="Personal" ApplyCssClass="rsCategoryBlue" />
        <telerik:ResourceStyleMapping Type="Type" Text="Meeting" ApplyCssClass="rsCategoryYellow" />
    </ResourceStyles>
    <AppointmentTemplate>
               <!--narrowed down template-->
        <div >
            <h2>
                <%# Eval("Subject") %>
            </h2>
            <div>
            </div>
        </div>
        
    </AppointmentTemplate>
</telerik:RadScheduler>

Bex

4 Answers, 1 is accepted

Sort by
0
Bex
Top achievements
Rank 1
answered on 17 Feb 2012, 02:29 PM
Anyone?
I'm assuming I'm doing something really silly? I have been trapsing through the documentation but can't fin anything like what I am doing?
0
Plamen
Telerik team
answered on 17 Feb 2012, 06:57 PM
Hello Becky,

 
I have reviewed the code you posted, but it is not enough to reproduce this unusual behavior. I could not find the topic which have been followed for implementation of this kind of binding the RadScheduler. Would you please link it, so I can observe it as well?

I would recommend you to follow the Bind To List demo where a similar functionality is used.

Hope this will help.

Regards,
Plamen Zdravkov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Bex
Top achievements
Rank 1
answered on 20 Feb 2012, 10:00 AM
Hello

This was the post I was referring to:http://www.telerik.com/community/forums/aspnet-ajax/scheduler/why-doesn-t-this-recur.aspx 
I am binding the scheduler directly to my database table as described in the documentation.
This is my database table:

AppointmentId  int
UserId  int
AppointmentTypeID  int
Start  datetime
[End]  datetime
RecurrenceRule  nvarchar(1024)
Subject  varchar(500)
Description  varchar(2000)
RecurrenceParentId  int

I am inserting appointments from the advanced appointment insert by calling my insert function with the values like this:
        (I tried manually adding in the \r\n as it doesn't get added in like this)
int? recurrentParentId = null;
if (e.Appointment.RecurrenceParentID != null) recurrentParentId = (int)e.Appointment.RecurrenceParentID;
AppointmentManager.AddUserAppointment(
    UserId, 
    1,
    e.Appointment.Start,
    e.Appointment.End,
    e.Appointment.RecurrenceRule,
    recurrentParentId,
    e.Appointment.Description,
    e.Appointment.Subject);
//int userId,int itemType,DateTime start,
            DateTime end, string reoccurenceRule, int? recurrenceParentId, string desciption, string subject

Does this help?

Bex
0
Bex
Top achievements
Rank 1
answered on 20 Feb 2012, 05:22 PM
I have worked out what it was.. in the page load I had my binding of the scheduler in my if(!isPostback)
I have moved it outside and it works.

I didn't realise this was the problem as everything else was working. Sorry my example code did not show this.
Tags
Scheduler
Asked by
Bex
Top achievements
Rank 1
Answers by
Bex
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or