This is a migrated thread and some comments may be shown as answers.

Rebind grid after update/insert

6 Answers 320 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
possible
Top achievements
Rank 1
possible asked on 08 Jan 2008, 09:43 AM
Hi..

I have a problem with refreshing scheduler after update/insert operation. It looks that RadScheduler doesnt rebind data from datasource but after update/insert adds new/existing item to appointments collections. Becouse I have some filters on page this is not good for me (sometimes user creates appointments that shouldn't be visible). I tried to use Rebind method on radscheduler in sqldatasource OnUpdate/OnInsert but this doesnt help. How to correctly rebind grid?

Regards

6 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 08 Jan 2008, 03:26 PM
Hi Tomasz,

If I understand correctly, you are inserting records directly in the database and then you are trying to rebind the RadScheduler instance with the new data. Is this correct?

Calling Rebind in OnUpdated/OnInserted should work. Are you sure that you are not doing in the OnUpdating/OnInserting event handlers?

If you can send us a simple page that demonstrates the issue, we will be able to debug it much faster.

All the best,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Joseph Rabinovich
Top achievements
Rank 1
answered on 17 Nov 2008, 10:23 PM

Hi Telerik,

I am having exactly the same problem - trying to re-populate scheduler with the data after update. 

Inside the RadScheduler1_AppointmentUpdate event (i am writing in vb.net) i collect data from the modified fields and store it in the database. I fire RadScheduler1.Rebind() right after I insert data but it looks like scheduler just refreshes itself after the update event is done.
In order to see the changes i have to do another postback.

Could you please help...

Thanks

Joe

 

 

 

 

0
Peter
Telerik team
answered on 20 Nov 2008, 11:48 AM
Hi Joseph,

How exactly do you implement this? Can you open a support ticket and send us a small sample of the problem?


Greetings,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Joseph Rabinovich
Top achievements
Rank 1
answered on 20 Nov 2008, 03:37 PM
Hi Peter,

I thought that since I am using my own data provider I have to just get the values from the modified fields, save them into the db and rebind the scheduler. But the way to do it - at list the only way I've found - is to do all of the above and update the selected appointment in the appointment collection with modified data, rebind the scheduler and then re-populate it with data from db

However, I only partially made it to work - partially because this approach will not work for recurrent appointment...

Here is the code:

Private

Sub RadScheduler1_AppointmentUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentUpdateEventArgs) Handles RadScheduler1.AppointmentUpdate

 

 

 

Dim ce As New AppointmentInfo

 

 

 

Dim app As Appointment = RadScheduler1.Appointments.FindByID(e.Appointment.ID)

 

ce.EventID = e.Appointment.ID

 

 

If e.Appointment.RecurrenceRule <> e.ModifiedAppointment.RecurrenceRule Then

 

 

app.RecurrenceRule = e.ModifiedAppointment.RecurrenceRule

ce.RecurrenceRule = e.ModifiedAppointment.RecurrenceRule

 

End If

 

 

 

If e.Appointment.RecurrenceParentID <> e.ModifiedAppointment.RecurrenceParentID Then

 

 

app.RecurrenceParentID = e.ModifiedAppointment.RecurrenceParentID

ce.RecurrenceParentID = e.ModifiedAppointment.RecurrenceParentID

 

End If

 

 

 

If e.Appointment.RecurrenceState <> e.ModifiedAppointment.RecurrenceState Then

 

 

app.RecurrenceState = e.ModifiedAppointment.RecurrenceState

ce.RecurrenceState = e.ModifiedAppointment.RecurrenceState

 

End If

 

 

 

If e.Appointment.Subject <> e.ModifiedAppointment.Subject Then

 

 

app.Subject = e.ModifiedAppointment.Subject

ce.Title = e.ModifiedAppointment.Subject

 

Else

 

 

ce.Title = e.Appointment.Subject

 

End If

 

 

 

If e.Appointment.Start <> e.ModifiedAppointment.Start Then

 

 

app.Start = e.ModifiedAppointment.Start

ce.StartDate = e.ModifiedAppointment.Start

 

Else

 

 

ce.StartDate = e.Appointment.Start

 

End If

 

 

 

If e.Appointment.End <> e.ModifiedAppointment.End Then

 

 

app.End = e.ModifiedAppointment.End

ce.EndDate = e.ModifiedAppointment.End

 

Else

 

 

ce.EndDate = e.Appointment.End

 

End If

 

 

ce.CreatedBy = HttpContext.Current.User.Identity.Name

 

If EventTypeID <> e.ModifiedAppointment.Resources.GetResourceByType("Event Type").Key.ToString Then

 

 

ce.EventTypeID = e.ModifiedAppointment.Resources.GetResourceByType(

"Event Type").Key.ToString

 

 

 

Else

 

 

ce.EventTypeID = EventTypeID

 

End If

 

 

 

If EventCssID <> e.ModifiedAppointment.Resources.GetResourceByType("Event Label").Key.ToString Then

 

 

ce.EventCSS = e.ModifiedAppointment.Resources.GetResourceByType(

"Event Label").Key.ToString

 

 

 

Else

 

 

ce.EventCSS = EventCssID

 

End If

 

 

 

Dim iReturn As Integer

 

 

 

Try

 

 

iReturn = DataAccess.UpdateSchedulerEvent(ce)

RadScheduler1.Rebind()

RePopulateSchedulerEvents()

 

Catch ex As Exception

 

 

 

Dim ErrorHandling As New Services.HSOExceptionService.EmailProvider

 

ErrorHandling.EmailApplicationError(ex.Message, ex.StackTrace, ex.InnerException.ToString)

 

 

End Try

 

 

 

End Sub

 

Private

Sub RePopulateSchedulerEvents()
RadScheduler1.DataSource = DataAccess.GetSchedulerEvents2(WebPartID, RadScheduler1.VisibleRangeStart, RadScheduler1.VisibleRangeEnd)

 

RadScheduler1.DataBind()

 

 

 

End Sub

Please let me know if this is the only solution.

Thanks

Joe

 

 

 

0
Joseph Rabinovich
Top achievements
Rank 1
answered on 21 Nov 2008, 04:53 PM
Hi,

I am wondering if somebody could reply to my question in the previous post?

Thanks

Joe
0
Peter
Telerik team
answered on 24 Nov 2008, 04:30 PM
Hi Joseph,

Please, open a support ticket and send us a working sample which demonstrates the problem. We will test it locally and try to resolve the issue.


Regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
possible
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Joseph Rabinovich
Top achievements
Rank 1
Peter
Telerik team
Share this question
or