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 > 0)
{
DataView dv = dsfinal.Tables[0].DefaultView;
dv.RowFilter = strExpr;
RadScheduler1.DataSource = dv;
RadScheduler1.DataBind();
RadScheduler1.SelectedView = SchedulerViewType.MonthView;
RadScheduler1.SelectedDate = Convert.ToDateTime(dv.Table.Rows[30]["ENDDATE"]);
}
}
</pre>
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.Merge(dslist);
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.
Thanks
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 > 0)
{
DataView dv = dsfinal.Tables[0].DefaultView;
dv.RowFilter = strExpr;
RadScheduler1.DataSource = dv;
RadScheduler1.DataBind();
RadScheduler1.SelectedView = SchedulerViewType.MonthView;
RadScheduler1.SelectedDate = Convert.ToDateTime(dv.Table.Rows[30]["ENDDATE"]);
}
}
</pre>
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.Merge(dslist);
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.
Thanks