I made this scheduler object:
<
telerik:RadScheduler
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"RadScheduler"
FirstDayOfWeek
=
"Monday"
LastDayOfWeek
=
"Sunday"
OverflowBehavior
=
"Expand"
SelectedView
=
"MonthView"
DayStartTime
=
"08:00:00"
DayEndTime
=
"19:59:59"
WorkDayStartTime
=
"08:00:00"
WorkDayEndTime
=
"20:00:00"
ShowAllDayRow
=
"true"
ShowFullTime
=
"true"
AllowDelete
=
"true"
AllowEdit
=
"true"
AllowInsert
=
"true"
StartEditingInAdvancedForm
=
"true"
StartInsertingInAdvancedForm
=
"true"
EnableDescriptionField
=
"true"
EnableExactTimeRendering
=
"true"
ShowFooter
=
"true"
Reminders-Enabled
=
"false"
EnableRecurrenceSupport
=
"false"
OnAppointmentDataBound
=
"RadScheduler_AppointmentDataBound"
OnAppointmentInsert
=
"RadScheduler_AppointmentInsert"
OnAppointmentDelete
=
"RadScheduler_AppointmentDelete"
OnAppointmentUpdate
=
"RadScheduler_AppointmentUpdate"
AppointmentStyleMode
=
"Auto"
OnFormCreated
=
"RadScheduler_FormCreated"
DataKeyField
=
"ID"
DataSubjectField
=
"Subject"
DataStartField
=
"Start"
DataEndField
=
"End"
DataDescriptionField
=
"Description"
ToolTip
=
"Subject"
>
<
AdvancedForm
Modal
=
"true"
></
AdvancedForm
>
<
MultiDayView
UserSelectable
=
"false"
/>
<
TimelineView
UserSelectable
=
"false"
/>
<
MonthView
UserSelectable
=
"true"
/>
<
AgendaView
UserSelectable
=
"true"
/>
<
TimeSlotContextMenuSettings
EnableDefault
=
"true"
></
TimeSlotContextMenuSettings
>
<
AppointmentContextMenuSettings
EnableDefault
=
"true"
></
AppointmentContextMenuSettings
>
</
telerik:RadScheduler
>
When use, in code behind, the insert ("RadScheduler_AppointmentInsert") or delete ("RadScheduler_AppointmentDelete") methods the scheduler refresh the appoitments correctly, withouth the necessity to use a rebind() option.
protected
void
RadScheduler_AppointmentInsert(
object
sender, AppointmentInsertEventArgs e)
{
Bisiona.ACE.Eal.Tenders.Appointment appointment =
new
Bisiona.ACE.Eal.Tenders.Appointment();
appointment.ID =
null
;
appointment.Subject = e.Appointment.Subject;
appointment.Start = e.Appointment.Start;
appointment.End = e.Appointment.End;
appointment.Description = e.Appointment.Description;
appointment.Calendar = e.Appointment.Resources.GetResourceByType(
"Calendar"
).Key.ToString();
appointment.Color = e.Appointment.Resources.GetResourceByType(
"Color"
).Key.ToString();
if
(TenderActual !=
null
) {
appointment.TenderID = TenderActual.TenderID;
appointment.VersionID = TenderActual.Version.VersionID;
}
if
(UsuarioActual !=
null
)
{
appointment.RoleID = UsuarioActual.Role.RoleID;
appointment.CodUsuario = UsuarioActual.CodUsuario;
}
bool
result =
false
;
string
ID =
string
.Empty;
result = Bisiona.ACE.Bll.Tenders.CalendarBo.SetCalendarAppointment(appointment,
ref
ID);
if
(result)
{
e.Appointment.ID = ID;
e.Appointment.ToolTip = e.Appointment.Subject;
((Master)
this
.Page.Master).ShowNotification(GetLocalResourceObject(
"msgSaveAppointment"
).ToString(),
"save"
);
}
else
{
e.Appointment.Visible =
false
;
((Master)
this
.Page.Master).ShowNotification(GetLocalResourceObject(
"msgErrorAppointment"
).ToString(),
"error"
);
}
}
protected
void
RadScheduler_AppointmentDelete(
object
sender, AppointmentDeleteEventArgs e)
{
bool
result =
false
;
result = Bisiona.ACE.Bll.Tenders.CalendarBo.DelCalendarAppointment(e.Appointment.ID.ToString());
if
(result)
((Master)
this
.Page.Master).ShowNotification(GetLocalResourceObject(
"msgDeleteAppointment"
).ToString(),
"save"
);
else
((Master)
this
.Page.Master).ShowNotification(GetLocalResourceObject(
"msgErrorAppointment"
).ToString(),
"error"
);
}
But, when use the update method ("RadScheduler_AppointmentUpdate") I recived correctly the Appointment and ModifiedAppoitment objects.
In this method, I can persist the object in database but the scheduler doesn't refresh.
protected
void
RadScheduler_AppointmentUpdate(
object
sender, AppointmentUpdateEventArgs e)
{
Bisiona.ACE.Eal.Tenders.Appointment appointment =
new
Bisiona.ACE.Eal.Tenders.Appointment();
appointment.ID = e.Appointment.ID.ToString();
appointment.Subject = e.ModifiedAppointment.Subject;
appointment.Start = e.ModifiedAppointment.Start;
appointment.End = e.ModifiedAppointment.End;
appointment.Description = e.ModifiedAppointment.Description;
appointment.Calendar = e.ModifiedAppointment.Resources.GetResourceByType(
"Calendar"
).Key.ToString();
appointment.Color = e.ModifiedAppointment.Resources.GetResourceByType(
"Color"
).Key.ToString();
if
(TenderActual !=
null
)
{
appointment.TenderID = TenderActual.TenderID;
appointment.VersionID = TenderActual.Version.VersionID;
}
if
(UsuarioActual !=
null
)
{
appointment.RoleID = UsuarioActual.Role.RoleID;
appointment.CodUsuario = UsuarioActual.CodUsuario;
}
bool
result =
false
;
result = Bisiona.ACE.Bll.Tenders.CalendarBo.UpdateCalendarAppointment(appointment);
if
(result)
((Master)
this
.Page.Master).ShowNotification(GetLocalResourceObject(
"msgSaveAppointment"
).ToString(),
"save"
);
else
((Master)
this
.Page.Master).ShowNotification(GetLocalResourceObject(
"msgErrorAppointment"
).ToString(),
"error"
);
}
I try also to do a rebind at the end, but nothing happend.
I want to call to database as less as possible.
Any Ideas?
Thank you so much.