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

RadScheduler - XML data source - RecurrenceRule exception

6 Answers 163 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Shamon Larson
Top achievements
Rank 1
Shamon Larson asked on 03 Dec 2010, 10:19 PM
Please help.

I receive the following error when adding an exception to the recurrence:

Object reference not set to an instance of an object.
[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.RecurrenceRule.TryParse(String input, RecurrenceRule& rrule) +970
   Telerik.Web.UI.Scheduling.AppointmentController.ExpandRecurrence(Appointment parent) +145
   Telerik.Web.UI.Scheduling.AppointmentController.AddAppointmentAndExpand(Appointment appointment) +16
   Telerik.Web.UI.RadScheduler.PerformDataBindingFromProvider(IEnumerable`1 providedAppointments) +127
   Telerik.Web.UI.RadScheduler.PerformSelect() +156
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   Telerik.Web.UI.RadScheduler.EnsureDataBound() +12
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +63
   Telerik.Web.UI.RadScheduler.CreateChildControls() +10
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

RadScheduler front-end: (I have the datarecurrenceparentkeyfield set as "MasterSeriesItemID")
<telerik:RadScheduler runat="server" ID="RadScheduler1" 
    width="700px" height="565px"
    Skin="Office2007" 
    overflowbehavior="Scroll" shownavigationpane="true"
    timezoneoffset="00:00:00" selectedview="MonthView"
    daystarttime="08:00:00" dayendtime="20:29:59" 
    datasourceid="Appointments_DS" 
    datakeyfield="Key" datastartfield="EventDate"
    dataendfield="EndDate" datasubjectfield="Title" 
    datarecurrencefield="RecurrenceRule" 

    datarecurrenceparentkeyfield="MasterSeriesItemID"

    customattributenames="Description, Category, Location, Event_Cancelled, RecurrenceData"
    allowdelete="false" allowedit="false" allowinsert="false" showviewtabs="true">
    <monthview userselectable="true" visibleappointmentsperday="2" />
    <TimelineView UserSelectable="false" />
    <appointmenttemplate>
        <asp:literal id="ApptBtn" runat="server" 
            text='<%# (Eval("Subject").ToString().Length >= 16) 
            ? Eval("Subject").ToString().Substring(0, Eval("Subject").ToString().IndexOf(" ")) + "..." 
            : Eval("Subject") %>'></asp:literal>
    </appointmenttemplate>
</telerik:RadScheduler>


Sample data:
<Appointment>
  <Key>171</Key>
  <Title>Policy Committee</Title>
  <Location>Room 100 (55 Somewhere Street)</Location>
  <EventDate>2011-01-01T10:30:00</EventDate>
  <StartDateString>1/1/2011</StartDateString>
  <EndDate>2094-03-04T10:30:00</EndDate>
  <Description>Meeting Description</Description>
  <Category>Committee Meeting</Category>
  <Event_Cancelled>0</Event_Cancelled>
  <fRecurrence>1</fRecurrence>
  <RecurrenceData><recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><monthlyByDay th="TRUE" weekdayOfMonth="first" monthFrequency="1" /></repeat><repeatForever>FALSE</repeatForever></rule></recurrence></RecurrenceData>
  <RecurrenceRule>
    <![CDATA[
        DTSTART:20110101T103000Z
        DTEND:20110101T103000Z
        RRULE:FREQ=MONTHLY;UNTIL=20940304T103000Z;INTERVAL=1;BYSETPOS=1;BYDAY=TH;
    ]]>
</RecurrenceRule>
  <fAllDayEvent>0</fAllDayEvent>
  <EventType>1</EventType>
  <Modified>2010-12-03T13:13:06</Modified>
</Appointment>
<Appointment>
  <Key>172</Key>
  <Title>Policy Committee</Title>
  <Location>Room 100 (55 Somewhere Street)</Location>
  <EventDate>2011-12-01T10:30:00</EventDate>
  <StartDateString>12/1/2011</StartDateString>
  <EndDate>2011-12-01T10:30:00</EndDate>
  <Description>Meeting Description</Description>
  <Category>Committee Meeting</Category>
  <Event_Cancelled>1</Event_Cancelled>
  <fRecurrence>1</fRecurrence>
  <RecurrenceData>Every 1 month(s) on the first Thursday</RecurrenceData>
  <RecurrenceRule>
    <![CDATA[
        DTSTART:20111201T103000Z
        DTEND:20111201T103000Z
        RRULE:UNTIL=20111201T103000Z;BYSETPOS=-1;
    ]]>
</RecurrenceRule>
  <fAllDayEvent>0</fAllDayEvent>
  <EventType>4</EventType>
  <RecurrenceID>2011-12-01T10:30:00</RecurrenceID>
  <MasterSeriesItemID>171</MasterSeriesItemID>
  <Modified>2010-12-03T14:41:34</Modified>
</Appointment>


XSL file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="Appointments">
        <Appointments>
            <xsl:apply-templates select="Appointment"/>
        </Appointments>
    </xsl:template>
  
    <xsl:template match="Appointment">
        <Appointment>
            <xsl:attribute name="Key">
                <xsl:value-of select="Key"/>
            </xsl:attribute>

            <xsl:attribute name="MasterSeriesItemID">
                <xsl:value-of select="MasterSeriesItemID"/>
            </xsl:attribute>

            <xsl:attribute name="Title">
                <xsl:value-of select="Title"/>
            </xsl:attribute>
            <xsl:attribute name="EventDate">
                <xsl:value-of select="EventDate"/>
            </xsl:attribute>
            <xsl:attribute name="EndDate">
                <xsl:value-of select="EndDate"/>
            </xsl:attribute>
            <xsl:attribute name="Category">
                <xsl:value-of select="Category"/>
            </xsl:attribute>
            <xsl:attribute name="Location">
                <xsl:value-of select="Location"/>
            </xsl:attribute>
            <xsl:attribute name="Description">
                <xsl:value-of select="Description"/>
            </xsl:attribute>
            <xsl:attribute name="Event_Cancelled">
                <xsl:value-of select="Event_Cancelled"/>
            </xsl:attribute>
            <xsl:attribute name="RecurrenceData">
                <xsl:value-of select="RecurrenceData"/>
            </xsl:attribute>
            <xsl:attribute name="RecurrenceRule">
                <xsl:value-of select="RecurrenceRule"/>
            </xsl:attribute>
        </Appointment>
    </xsl:template>
</xsl:stylesheet>

6 Answers, 1 is accepted

Sort by
0
Shamon Larson
Top achievements
Rank 1
answered on 03 Dec 2010, 10:55 PM
I solved the first error by removing the "RecurrenceRule" for the exception.

But how do I get only the cancelled meeting to show instead of both when using the monthly view of RadScheduler? It correctly shows only my cancelled event when using the week view and day view.

Thanks in advance.
0
Nikolay Tsenkov
Telerik team
answered on 08 Dec 2010, 03:03 PM
Hello Shamon Larson,

As much as I understand you use the xsl to transform the xml you actually store and then probably pass it to a XmlSchedulerProvider to feed the Scheduler with it.
Is this the case or not?

If this is the case, could you, please, send the resulting xml, that the schedulerProvider consumes (after style transformations)?


Regards,
Nikolay Tsenkov
the Telerik team
Browse the vast support resources we have to jumpstart 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.
0
Shamon Larson
Top achievements
Rank 1
answered on 08 Dec 2010, 03:28 PM
I already gave you everything you need to test. I gave you the XML and the XSL.

<asp:xmldatasource id="Appointments_DS" runat="server" 
    datafile="/App_Data/CommissionersMeetingAppointments.xml"
    transformfile="/App_Data/Appointments.xsl"></asp:xmldatasource>

Simply save the data that I gave you as the corresponding XML and XSL files and try it. If you want to see what the XML looks like after the transformation, then use the asp:xml tag instead and change the datafile to documentsource and transformfile to transformsource.

At any rate, I do not currently have the "month view" problem only because I'm hiding it. I added two other calendar items to the list that occur earlier in the day than the one in question and I'm only showing two calendar items per day with the "Show more" link visible for additional calendar items.

Thanks,
Shamon Larson
0
Nikolay Tsenkov
Telerik team
answered on 15 Dec 2010, 11:36 AM
Hello Shamon Larson,

Well, I get an exception for multiple rootItems in the Xml file.
Could you, please, again check the data you provided earlier in the thread?

Actually, once you get the Xml with correct Xml structure and transform it successfully with your xsl, please, send only the Xml file that goes actually as a dataSource for the scheduler. There is just no relevance between the xsl transformations and RadScheduler, that is why there isn't a need to complicate additionally the investigation, with something that is not relevant.

Also, could you, please, specify why do you need this transformation and why not just store the Scheduler's data in regular format, without the overhead of transforming it?
Another thing that comes to mind is - what about transformation from Scheduler's format to current format of storage - isn't that required?
I mean if you have format A and transformation x => from A transform (using x) -> to B, but I don't think you can use the same transformation (x) in order to do this: B transform (using x) -> to A.


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.
0
Shamon Larson
Top achievements
Rank 1
answered on 15 Dec 2010, 01:43 PM
You're not helping. Please end the thread.
0
Simon
Telerik team
answered on 21 Dec 2010, 01:55 PM
Hi Shamon Larson,

The server-side NullReferenceException when you add an exception is thrown because of the recurrence rule of that exception is invalid. Exceptions in RadScheduler do not have recurrence rules. The latter belong only to the master Appointment, which keeps track of all of its exceptions in its rule.

Please see this help topic which describes how the recurrence engine of RadScheduler works. Please use the code examples there to generate a valid rule for your case.

Just as an example, here is what the reccurence rule of the recurrent Appointment you showed in your first post should look like when an exception to it is added:
DTSTART:20110101T073000Z
DTEND:20110101T080000Z
RRULE:FREQ=MONTHLY;UNTIL=20120614T210000Z;INTERVAL=1;BYSETPOS=1;BYDAY=TH
EXDATE:20110203T073000Z

The exception itself needs only its <RecurrenceParentID /> property to point to the ID of the master Appointment.

Finally you can use an XmlProvider (as in this demo) and observe the resultant XML file for the correct format of XML Appointment data.

I hope this helps.

Kind regards,
Simon
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
Shamon Larson
Top achievements
Rank 1
Answers by
Shamon Larson
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Simon
Telerik team
Share this question
or