RedScheduler & Resources Issue

6 posts, 0 answers
  1. Iain
    Iain avatar
    3 posts
    Member since:
    Jun 2011

    Posted 15 Jun 2011 Link to this post

    Hi All,

    I'm new to the Telerik comunity and control suite, and after seeing the demo's of the RadScheduler i was blown awa. I've started evaluating whether this control will be able to be encorporated into our creaking architecture and in doing that i've come across a problem i can't quite get my head around. Please note that this is currently using the default XML file for the data provider (i haven't got round to using our database yet).

    I've put the following code in the ASPX page:

    <telerik:RadScriptManager ID="sman" runat="server" EnableTheming="false"/>
    <telerik:RadScheduler ID="radCalendar" runat="server" AdvancedForm-Enabled="true" StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true" />

    And the following code in the code behind (this is to programmatically add our items to the dropdown, it will be from a database but i'm hardcoding this to mock this for testing purposes).

    protected void Page_Init(object sender, EventArgs e)
    {
        ResourceType priority = new ResourceType("PriorityLevel");
        radCalendar.ResourceTypes.Add(priority);
        radCalendar.Resources.Add(new Resource("PriorityLevel", 1, "Low"));
        radCalendar.Resources.Add(new Resource("PriorityLevel", 2, "High"));
           
          ResourceType user = new ResourceType("S7User");
          radCalendar.ResourceTypes.Add(user);
          user.AllowMultipleValues = true;
          radCalendar.Resources.Add(new Resource("S7User", 8, "Iain"));
          radCalendar.Resources.Add(new Resource("SUser", 9, "Nick"));
          radCalendar.Resources.Add(new Resource("S7User", 10, "Paul"));
          radCalendar.Resources.Add(new Resource("S7User", 11, "Stephan"));
         radCalendar.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), true);
    }

    The 'Priority' field now appears as a drop down, as does the S7User, these save too perfectly into the 'Appointments.xml' file, but, when i try to reopen the calendar i get the error:

    Cannot find resource of type 'PriorityLevel' with Key=1 for appointment with ID=41.


    The XML that is saved in the 'Appointments.xml' file is as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <Appointments>
      <NextID>42</NextID>
      <Appointment>
        <ID>41</ID>
        <Subject>asdfasdf</Subject>
        <Start>2011-06-15T09:30Z</Start>
        <End>2011-06-15T10:30Z</End>
        <Resources>
          <PriorityLevel Key="1" />
          <S7User Key="8" />
        </Resources>
      </Appointment>
    </Appointments>

    Can anyone offer any guidance as to why this is happening please? It works when I have the resources in the XML file, but taking them out breaks it, even though they are added to the control. One thing to note is in the Page_Init they are added to the 'Resources' collection in the control.

    Any help is greatly appreciated.

    Iain

  2. Plamen
    Admin
    Plamen avatar
    2733 posts

    Posted 17 Jun 2011 Link to this post

    Hello Iain,

    Please, make sure that you add the resources in the XML file like this:
    <?xml version="1.0" encoding="utf-8"?>
    <Appointments>
      <NextID>59</NextID>
      <Resources>
        <PriorityLevel>
          <Key>1</Key>
          <Text>Low</Text>
        </PriorityLevel>
        <PriorityLevel>
          <Key>2</Key>
          <Text>High</Text>
        </PriorityLevel>
        <S7User>
          <Key>7</Key>
          <Text>Iain</Text>
        </S7User>
        <S7User>
          <Key>8</Key>
          <Text>Nick</Text>
        </S7User>
        <S7User>
          <Key>9</Key>
          <Text>Paul</Text>
        </S7User>
        <S7User>
          <Key>10</Key>
          <Text>Stephan</Text>
        </S7User>
      </Resources>
      <Appointment>
        <ID>21</ID>

    If you meet other difficulties don't hesitate to ask.

    Regards,
    Plamen Zdravkov
    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Iain
    Iain avatar
    3 posts
    Member since:
    Jun 2011

    Posted 17 Jun 2011 Link to this post

    Thanks Plamen

    As i previously said, it works when I have the resources in the XML file, i want to add the resrouces programmatically in the code-behind? Is this possible?

    Thanks,

    Iain
  5. Dan Lehmann
    Dan Lehmann avatar
    103 posts
    Member since:
    May 2011

    Posted 17 Jun 2011 Link to this post

    Did you notice that you spelled "S7User" "SUser" for one of the resources?

    I am working though similar issues. I found this example project helpful: http://www.telerik.com/community/forums/aspnet-ajax/scheduler/dynamic-resources-in-codebehind.aspx#1325062
  6. Iain
    Iain avatar
    3 posts
    Member since:
    Jun 2011

    Posted 17 Jun 2011 Link to this post

    Thanks Dan i'll check that out now.
  7. Plamen
    Admin
    Plamen avatar
    2733 posts

    Posted 21 Jun 2011 Link to this post

    Hi Iain,

    When you use XmlProvider to bind the RadScheduler you can't add the resources programmatically without changing the file. However when you use SqlDataSource you can, as it is shown in the demo in the forum that was posted by Dan.

    Best wishes,
    Plamen Zdravkov
    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
UI for ASP.NET Ajax is Ready for VS 2017