Rebind grid after update/insert

7 posts, 0 answers
  1. possible
    possible avatar
    77 posts
    Member since:
    Oct 2006

    Posted 08 Jan 2008 Link to this post

    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
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 08 Jan 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Joseph Rabinovich
    Joseph Rabinovich avatar
    5 posts
    Member since:
    Aug 2012

    Posted 17 Nov 2008 Link to this post

    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

     

     

     

     

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 20 Nov 2008 Link to this post

    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.
  6. Joseph Rabinovich
    Joseph Rabinovich avatar
    5 posts
    Member since:
    Aug 2012

    Posted 20 Nov 2008 Link to this post

    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

     

     

     

  7. Joseph Rabinovich
    Joseph Rabinovich avatar
    5 posts
    Member since:
    Aug 2012

    Posted 21 Nov 2008 Link to this post

    Hi,

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

    Thanks

    Joe
  8. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 Nov 2008 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017