How to Update an XML File from a RadSchedular

2 posts, 0 answers
  1. Vuyiswa
    Vuyiswa avatar
    188 posts
    Member since:
    Jan 2010

    Posted 20 Jul 2010 Link to this post

    Good Day

    i am using a RaSchedular(Telerik) and i have an XML File on my solution and i bind my Schedular like this

       <pre> private void Bind_Viewer_For(String Module)

                string strExpr = "Code like '%" + Module + "%'";
                XmlDataDocument xmlDatadoc = new XmlDataDocument();
                xmlDatadoc.DataSet.ReadXml(@"C:\Pilot Project\App_Data\TimeTable.xml");
                RadScheduler1.DataStartField = "STARTDATE";
                RadScheduler1.DataSubjectField = "DESCRIPTION";
                RadScheduler1.DataEndField = "ENDDATE";
                RadScheduler1.DataKeyField = "ID";

                dsfinal = xmlDatadoc.DataSet;

                if (dsfinal.Tables[0].Rows.Count &gt; 0)
                    DataView dv = dsfinal.Tables[0].DefaultView;
                    dv.RowFilter = strExpr;
                    RadScheduler1.DataSource = dv;
                    RadScheduler1.SelectedView = SchedulerViewType.MonthView;
                    RadScheduler1.SelectedDate = Convert.ToDateTime(dv.Table.Rows[30]["ENDDATE"]);




    dsfinal is declared Globally. i am filtering my data as you can see in the expression and bind the control with the Detail view.  Now , my problem is when the updates are made. In the Schedular when updates are made , or when an appointment is moved
    i need to Update the Dataset with the changes made. The Demo here  Explains a simple xml binding, but i am binding the Schedular with a Dataset and when changes i made, i want to save the changes in the dataset.

    Now i have a save button that is supposed to take the changes made in the dataset and merge it back to the xml and my code looks like this

     protected void btnCommitChanges_Click(object sender, EventArgs e)

                XmlDataDocument xmlDatadoc = new XmlDataDocument();
                xmlDatadoc.DataSet.ReadXml(@"C:\Pilot Project\App_Data\TimeTable.xml");

                DataSet dslist = new DataSet();
                dslist = xmlDatadoc.DataSet;

                dsfinal.WriteXml(@"C:\Pilot Project\App_Data\TimeTable.xml");


     as you can see , i am taking the xml that is currently on the file system and i am loading it to a dataset and merge the two dataset. My question here is that is it going to updates the changes or it will override or insert new elements as if i am adding a new record on the xml ?

    Again, after refresh the page, i could see the changes were not saved and the xml have not changed from the changes that were made in the dataset.

  2. Peter
    Peter avatar
    6637 posts

    Posted 23 Jul 2010 Link to this post

    Hi Vuyiswa,

    You should update your data source on AppointmentUpdate/Insert/Delete, similarly to the approach from this demo.

    Best wishes,
    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
Back to Top