I'm having some trouble with, I think, the radSchedular.
I have a radSchedular which I bind to a dataset.
I expected the radSchedular to update when I changed the dataset. But I don't get this.
My question is. How do I update the display of a radSchedular when the Dataset updates?
Example code:
How I bind:-
private void BindToDataSet()
{
//Map fields for Appointments
AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo();
appointmentMappingInfo.Start = "appointments_Start";
appointmentMappingInfo.End = "appointments_End"; //LOTS OF THESE SO I CUT THE REST OUT OF THIS EXAMPLE
datasource.EventProvider.Mapping = appointmentMappingInfo;
datasource.EventProvider.DataSource = dsSchedule.Tables[0]; //MY DATASET IS GENERATED FROM AN XML FILE WITH A SCHEMA
//Bind
radScheduler1.DataSource = datasource;
}
How I get the dataset changed events:-
private void BindEvents(){
// RowChanged event handler.
dsSchedule.Tables[0].RowChanged += new DataRowChangeEventHandler(RowChanged);
// Add a RowDeleted event handler.
dsSchedule.Tables[0].RowDeleted += new DataRowChangeEventHandler(RowDeleted);}
Event method:-
private void RowChanged(object sender, DataRowChangeEventArgs e){
StoreToXML();
BindEvents();}
How I store the data and, I thought, refresh the radSchedular:-
private void StoreToXML(){
//remove the dataset change deligates as we are about to change the Dataset and we don't want a loop
UnBindEvents();
foreach (DataRow rowAppointments in dsSchedule.Tables["Appointments"].Rows)
{
string currentResource = rowAppointments["appointments_ResourceID"].ToString();
foreach (DataRow rowResources in dsSchedule.Tables["Resources"].Rows)
{
if (rowResources["resources_ID"].ToString() == currentResource)
{
rowAppointments["appointments_Location"] = rowResources["resources_Name"]; //THIS IS WHY I WANT THE radSCHEDULAR TO UPDATE.
} //I WANT TO SEE THE RESOURCE IN THE LOCATION FIELD
}
}
StreamWriter myStreamWriter = new StreamWriter(@"E:\My .NET\Hardware_Scheduler_Application\stdData.xml");
dsSchedule.WriteXml(myStreamWriter, XmlWriteMode.WriteSchema);
myStreamWriter.Close();
BindToDataSet(); //I THOUGHT THAT THIS WOULD REFRESH THE radSCHEDULAR
//rebind the changed events
BindEvents()}