
Michael Malone
Top achievements
Rank 1
Michael Malone
asked on 24 Sep 2010, 03:18 PM
When I add an appointment to the RadScheduler it writes the record to the database in the AppointmentInsert() function. This properly saves the record but doesn't update the RadScheduler for the user. They have to manually refresh their browser for the changes to appear. How do I get it to update after every event without the user hitting refresh in the browser?
protected
void
Page_Load(
object
sender, EventArgs e)
{
DrAppointment app =
new
DrAppointment();
RadScheduler1.DataSource = app.GetAll();
RadScheduler1.DataBind();
RadScheduler1.AppointmentInsert +=
new
Telerik.Web.UI.AppointmentInsertEventHandler(RadScheduler1_AppointmentInsert);
RadScheduler1.AppointmentUpdate +=
new
Telerik.Web.UI.AppointmentUpdateEventHandler(RadScheduler1_AppointmentUpdate);
RadScheduler1.AppointmentDelete +=
new
Telerik.Web.UI.AppointmentDeleteEventHandler(RadScheduler1_AppointmentDelete);
RadScheduler1.FormCreated +=
new
Telerik.Web.UI.SchedulerFormCreatedEventHandler(RadScheduler1_FormCreated);
}
void
RadScheduler1_AppointmentInsert(
object
sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
{
if
(ExceedsLimit(e.Appointment))
{
lblError.Text =
"Another appointment exists in this time slot."
;
e.Cancel =
true
;
}
else
{
DrAppointment app =
new
DrAppointment(e.Appointment);
app.Save();
}
}
7 Answers, 1 is accepted
0

Michael Malone
Top achievements
Rank 1
answered on 24 Sep 2010, 03:35 PM
Looks like I have to set the DataSource property in each event and then call DataBind().
0
Hi Michael,
You can also try calling RadScheduler's Rebind() method in the AppointmentInsert handler right after app.Save();
Greetings,
Peter
the Telerik team
You can also try calling RadScheduler's Rebind() method in the AppointmentInsert handler right after app.Save();
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

Michael Malone
Top achievements
Rank 1
answered on 29 Sep 2010, 02:43 PM
Hmm, that's what I initially thought. I just went back and tried that again... calling RachScheduler1.Rebind() after save but it still doesn't appear to be updating the page for the user?
0
Accepted
You are right. Sorry for misleading you. With the Rebind method() RadScheduler still uses the old data source so it won't help. The solution you have discovered seems to be optimal for this case.
Best wishes,
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

Greg Ogle
Top achievements
Rank 1
answered on 12 Oct 2010, 08:54 PM
I seem to be having a similar issue, though my DataSource is a LinqToSQL object, and the solution doesn't work in my case.
Here is the code snippets of my code:
If I make an additional change, whether edit, insert, or delete, I will see this change. It always shows the previous change.
The only thing that works so far is a Response.Redirect, but that loses all ViewState.
Here is the code snippets of my code:
void Scheduler_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
{
//Calendar Item is a LinqToSql object
var item = new CalendarItem()
{
UserId = userId;
StartDate = e.Appointment.Start,
EndDate = e.Appointment.End,
Subject = e.Appointment.Subject
};
repo.Add(item); //Adds the Item via InsertOnSubmit in LinqToSql Data Context
repo.Save(); //Submits changes via LinqToSql Data Context
Scheduler.DataSource = repo.GetCalendarItems(); //return LinqToSql IEnumerable<
CalendarItems
>
Scheduler.DataBind();
//tried Rebind() too
}
The only thing that works so far is a Response.Redirect, but that loses all ViewState.
0
Hello Greg,
I can't find anything with your code that could cause the problem. Do you have a simple working demo which you can send us via a support ticket for testing?
Greetings,
Peter
the Telerik team
I can't find anything with your code that could cause the problem. Do you have a simple working demo which you can send us via a support ticket for testing?
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

Greg Ogle
Top achievements
Rank 1
answered on 18 Oct 2010, 03:44 PM
Thanks for looking at this. I finally found that it was not properly binding in the Page_Load, but rather always binding in OnInit.