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

Binding XML File to A RadSchedular

9 Answers 101 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Vuyiswa
Top achievements
Rank 2
Vuyiswa asked on 06 Jul 2010, 10:43 AM
Good Day

I have a radSchedular that is Defined like this

  
     
        <telerik:RadScheduler ID="RadScheduler1" runat="server" Height="388px" TimeZoneOffset="03:00:00" 
            SelectedDate="2007-03-30" DayStartTime="08:00:00" DayEndTime="18:00:00" 
            OnDataBound="RadScheduler1_DataBound" 
            Skin="Vista" Width="1006px" DataEndField="ENDDATE" DataKeyField="ID"  
            DataSourceID="XmlDataSource1" DataStartField="STARTDATE"  
            DataSubjectField="SUBJECTS"
        </telerik:RadScheduler> 
     
  
        <asp:XmlDataSource ID="XmlDataSource1" runat="server"  
            DataFile="~/App_Data/TimeTable.xml"></asp:XmlDataSource> 
     


and my XML nodes looks like this

<Root> 
  <Datarow> 
    <ID>1</ID> 
    <DY>25</DY> 
    <SESS>2</SESS> 
    <CODE>CMH10431</CODE> 
    <DESCRIPTION>CMH10431</DESCRIPTION> 
    <ABREV>P</ABREV> 
    <TYPE>P</TYPE> 
    <NUMBER>1</NUMBER> 
    <GRPNAME>V0022012</GRPNAME> 
    <GRPNUMBER>1</GRPNUMBER> 
    <DURATION>1</DURATION> 
    <STUDENTS>1</STUDENTS> 
    <VENUE>V0022012</VENUE> 
    <CAPACITY>50</CAPACITY> 
    <MODLID>641</MODLID> 
    <TERM>Oct2008</TERM> 
    <STAFFTERM>Oct2008</STAFFTERM> 
    <STARTDATE>2008-10-30T17:00:00</STARTDATE> 
    <ENDDATE>2008-10-30T17:00:00</ENDDATE> 
    <LENGTH>180</LENGTH> 
  </Datarow> 
  <Datarow> 
    <ID>2</ID> 
    <DY>1</DY> 
    <SESS>1</SESS> 
    <CODE>PVL101Q1</CODE> 
    <DESCRIPTION>PVL101Q1</DESCRIPTION> 
    <ABREV>P</ABREV> 
    <TYPE>P</TYPE> 
    <NUMBER>1</NUMBER> 
    <GRPNAME>V0022012</GRPNAME> 
    <GRPNUMBER>1</GRPNUMBER> 
    <DURATION>1</DURATION> 
    <STUDENTS>4</STUDENTS> 
    <VENUE>V0022012</VENUE> 
    <CAPACITY>50</CAPACITY> 
    <MODLID>2634</MODLID> 
    <TERM>Oct2008</TERM> 
    <STAFFTERM>Oct2008</STAFFTERM> 
    <STARTDATE>2008-10-06T08:00:00</STARTDATE> 
    <ENDDATE>2008-10-06T08:00:00</ENDDATE> 
    <LENGTH>180</LENGTH> 
  </Datarow> 
</Root> 




and when i run my test app , i get an Error

DataBinding: 'System.Web.UI.WebControls.XmlDataSourceNodeDescriptor' does not contain a property with the name 'ID'.


Thanks

9 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 07 Jul 2010, 03:15 PM
Hello Vuyiswa,

You can use the XML provider demo. The XmlSchedulerProvider will automatically take care of inserting, deleting and updating an appointment. If you want to pesist the changes to your xml file, set the second parameter of the constructor to true:

* * *
provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), true); 
* * *



All the best,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vuyiswa
Top achievements
Rank 2
answered on 08 Jul 2010, 05:51 AM
Hi Admin

i have removed the data-source on the markup and i do the code behind binding as below

 
    protected void Page_Init(object sender, EventArgs e) 
          { 
              XmlSchedulerProvider provider; 
 
              if ((Session["ProviderSessionKey"] == null) || (!IsPostBack)) 
              { 
                  provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/TimeTable.xml"), true); 
 
                  Session["ProviderSessionKey"] = provider; 
              } 
              else 
              { 
                  provider = (XmlSchedulerProvider)Session["ProviderSessionKey"]; 
              } 
 
              RadScheduler1.Provider = provider; 
    } 
 
and when i run it i get

Object reference not set to an instance of an object.


on this line
 
     provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/TimeTable.xml"), true); 


my app data has the xml file

Thanks

0
Peter
Telerik team
answered on 13 Jul 2010, 12:00 PM
Hello Vuyiswa,

Please, try the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
  
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        RadScheduler1.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/TimeTable.xml"), true);
         
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }   
}

Do you still get errros?

Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vuyiswa
Top achievements
Rank 2
answered on 14 Jul 2010, 11:20 AM
Good Day Admin

THanks for the Reply, i am sorry to reply so late, i was not at work yesterday. i have changed my function to look like this

private void Bind_Viewer()
{
    XmlSchedulerProvider provider;
    if ((Session["ProviderSessionKey"] == null) || (!IsPostBack))
    {
        //provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/TimeTable.xml"), true);
        RadScheduler1.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/TimeTable.xml"), true); 
       // Session["ProviderSessionKey"] = provider;
    }
    else
    {
        provider = (XmlSchedulerProvider)Session["ProviderSessionKey"];
    }
  //  RadScheduler1.Provider = provider;
}
and i called it like this in the Init event of the Page

protected void Page_Init(object sender, EventArgs e)
{
    Bind_Viewer();
}
and i have relialised something strange, i have used the xml provided by documentation on your website. that one is not giving me an Error , but mine is giving me an Error . The XML i copied is here http://www.telerik.com/help/aspnet-ajax/schedule_databindingimplementingaprovider.html and it works but mine gives the same Error as above..

Thanks

0
Peter
Telerik team
answered on 14 Jul 2010, 04:17 PM
Hello Vuyiswa Maseko,

The XmlSchedulerProvider is built-in so you don't have to implement it from scratch. You can go ahead and use it right away. In the online demos we use sessions, but in your actual project you don't have to. You can leave just this line of code in your Bind_Viewer() method:

RadScheduler1.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/TimeTable.xml"), true);

I have attached a simple demo for reference.

Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Shaan
Top achievements
Rank 1
answered on 27 Oct 2010, 12:06 PM
Hi, I am new to asp.net & perhaps to RadControls for ASP.NET AJAX.

XML as DataSource is our project's main requirement, I have used XmlSchedulerProvider for displaying RadScheduler.

Can you please provide me a Sample Application for RADScheduler using XML as DataSource regarding Insert , Update & delete Operation on XMLDataSource.

So if it works fine this will help me to decide to use Telerik in project.
0
Vuyiswa
Top achievements
Rank 2
answered on 27 Oct 2010, 12:51 PM
0
Shaan
Top achievements
Rank 1
answered on 28 Oct 2010, 11:52 AM
Thanks for the Quick reply Vuyiswa Maseko ..!!

I followed ur First link & Implemented it.. however I faced a problem...

There is MethodName GetAppointments(RadScheduler owner) which has a method in a "Resources" Case known as
LoadAppointmentResources(owner, appointment, appointmentData).

The defintion for LoadAppointmentResources method is not provided anywhere in the example.

Can you please provide it,

Thanks in advance..
0
Peter
Telerik team
answered on 02 Nov 2010, 04:06 PM
Hi Shaan,

The XmlSchedulerProvider is built-in and if you need to review how it is implemented, you should look in the source code of Telerik.Web.UI. 

Alternatively, you can review the Database Provider.


All the best,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
Vuyiswa
Top achievements
Rank 2
Answers by
Peter
Telerik team
Vuyiswa
Top achievements
Rank 2
Shaan
Top achievements
Rank 1
Share this question
or