RadScheduler rebind problem

19 posts, 0 answers
  1. Subodh Gupta
    Subodh Gupta avatar
    8 posts
    Member since:
    Apr 2009

    Posted 19 Aug 2013 Link to this post

    Hello Telerik team,
    I tried to found a solution how update RadScheduler after appoinment update but without success. For create/update appoinment I use iframe. On OnClientAppointmentInserting or OnClientAppointmentEditing I use   jQuery plugin PrettyPhoto to open iframe.
    function onAppointmentInserting(sender, eventArgs) {
            eventArgs.set_cancel(true);
            var targetSlot = eventArgs.get_targetSlot();
            var categoryId = targetSlot.get_resource().get_key();
            var day = eventArgs.get_startTime();
            var date = '' + (1 + day.getMonth()) + '/' + day.getDate() + '/' + day.getFullYear();
            jQuery.prettyPhoto.open('../PopUpAppoinmentInsert.aspx?categoryId=' + categoryId + '&start=' + date + '&end=' + date + '&iframe=true&width=700&height=500', 'Calendar item..');
            jQuery('a.pp_close').css("display", "none");
        }
    function OnAppointmentEditing(sender, eventArgs) {
       eventArgs.set_cancel(true);
       var eventId = eventArgs.get_appointment().get_id()
       jQuery.prettyPhoto.open('../PopUpAppoinmentInsert.aspx?eventId=' + eventId + '&iframe=true&width=700&height=500', 'Calendar item..');
       jQuery('a.pp_close').css("display", "none");
    }
    After user click Save 
    protected void bSave_Click(object sender, EventArgs e)
           {
               try
               {
                   CalendarCategory category = null;
                   CalendarEvent calendarEvent = null;
                   CalendarEventGovernor governor = new CalendarEventGovernor();
                   CalendarCategoryGovernor categoryGov = new CalendarCategoryGovernor();
     
                   //create entity
                  // ...
                  // then save
                  governor.Save(calendarEvent);
                   // after I write a javascript to close iframe and run my rebind method
                   ClientScriptsHelper.RegisterScript("window.parent.jQuery.prettyPhoto.close();window.parent.rebind(1);", true);
               }
               catch
               {
                
               }             
           }

    How I rebind data from javascript
    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" OnAjaxRequest="RadAjaxManager2_AjaxRequest" DefaultLoadingPanelID="RadAjaxLoadingPanel2" >
        <AjaxSettings>    
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1"  />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    function rebind(schedule)
       {
           var ajax = $find('<%= RadAjaxManager2.ClientID%>');
           ajax.ajaxRequest("ReBindRadScheduler" + schedule);
       }
    and server part
    protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
     
                if (!IsPostBack)
                {
                    cboCategory.DataSource = GetCategories();
                    cboCategory.DataBind();
                    cboCategory.Items[0].Selected = true;
                    cboCategory.Visible = false;
                    FillSchedule(RadScheduler1, 1);
                    FillSchedule(RadScheduler2, 2);
                    FillSchedule(RadScheduler3, 3);
                    FillSchedule(RadScheduler4, 4);
                    FillSchedule(RadScheduler5, 5);
                }         
            
     
    protected void RadAjaxManager2_AjaxRequest(object sender, AjaxRequestEventArgs e)
            {
                if (e.Argument == "ReBindRadScheduler1")
                    FillSchedule(RadScheduler1, 1);
               //......
                if (e.Argument == "ReBindRadScheduler5")
                    FillSchedule(RadScheduler5, 5);
            }      
     
     private void FillSchedule(RadScheduler MainScheduler, int categoryId)
            {
                var defualtMinTime = TimeSpan.FromHours(6);
                var defualtMaxTime = TimeSpan.FromHours(23);
     
                MainScheduler.DayStartTime = defualtMinTime;
                MainScheduler.WorkDayStartTime = MainScheduler.DayStartTime;
     
                MainScheduler.DayEndTime = defualtMaxTime;
                MainScheduler.WorkDayEndTime = MainScheduler.DayEndTime;
     
                
                MainScheduler.Appointments.Clear();
     
                MainScheduler.DataSource = null;
                MainScheduler.DataBind();
                var categories=GetCategoriesResources(categoryId);  
                MainScheduler.ResourceTypes.First().DataSource =   categories;     
                //SchedulerToolTipManager.TargetControls.Clear();
                CalendarEventGovernor governor = new CalendarEventGovernor();
     
                MainScheduler.DataSource = governor.GetAllBy(categories.Select(x => x.Id).ToArray(), MainScheduler.SelectedDate, MainScheduler.SelectedDate.AddDays(MainScheduler.TimelineView.NumberOfSlots));
                MainScheduler.DataBind();
     
                MainScheduler.OnClientAppointmentInserting =  "onAppointmentInserting";
                MainScheduler.OnClientAppointmentEditing = "OnAppointmentEditing";
                MainScheduler.OnClientAppointmentMoveEnd = "OnClientAppointmentMoveEnd";
                MainScheduler.OnClientAppointmentMoveStart = "OnClientAppointmentMoveStart";
            }

    RadScheduler populated on Init but not rebind after insert/update.  If I refresh page changes appear
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 21 Aug 2013 Link to this post

    Hello,

    Please try with the below code snippet.

    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" OnAjaxRequest="RadAjaxManager2_AjaxRequest"
            DefaultLoadingPanelID="RadAjaxLoadingPanel2">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager2">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>


    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Subodh Gupta
    Subodh Gupta avatar
    8 posts
    Member since:
    Apr 2009

    Posted 22 Aug 2013 Link to this post

    Hello Jayesh,

    Thanks for help! It's work!
  5. Kalpna
    Kalpna avatar
    37 posts
    Member since:
    Jun 2013

    Posted 28 Dec 2013 Link to this post

    Hii Jayesh,
    Is it possible to rebind Rad-Scheduler without using Ajax.
  6. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 30 Dec 2013 Link to this post

    Hello,

    Yes -you can rebind it by using the Rebind method:
    RadScheduler1.Rebind();

    Regards,
    Plamen
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  7. Kalpna
    Kalpna avatar
    37 posts
    Member since:
    Jun 2013

    Posted 30 Dec 2013 Link to this post

    Hello Sir,
    Rebind Method will not work and i also applied it. Please check this link:-
    http://www.telerik.com/community/forums/aspnet-ajax/scheduler/appointmentinsert-not-updating-until-page-is-manually-refreshed.aspx

    In which Peter said "With the Rebind method() RadScheduler still uses the old data source so it won't help."

    Using Rebind method i did not get my solution. Please tell another way to refresh my RadScheduler data without refreshing the browser and without using AJAX.
  8. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 01 Jan 2014 Link to this post

    Hello,

    If you want to rebind RadScheduler without refreshing the browser and without using AJAX the only way would be to use web service binding as in this on-line demo for example. 

    Hope this will lead you into the right direction.

    Regards,
    Plamen
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  9. Costas
    Costas avatar
    1 posts
    Member since:
    Jan 2014

    Posted 22 Jan 2014 Link to this post

    Hi im trying to rebind or / show the new inserted appointment to all connected clients that are viewing the scheduler at that time.

    im currently trying to use SignalR to control these refreshes of new appointments. do you know if radscheuler supports signalr??

    i do have a example going but failing to insert the date and time when the values are being returned from the hub.

    so i was thinking to insert the datetime into the scheduler before it reaches the hub, then when the data is returned from the hub do a scheduler rebind to update all connected clients. 

    any thoughts anyone?

    i can supply code if nessesary.

    thank you
  10. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 28 Jan 2014 Link to this post

    Hi Costas,

    Yes indeed in the current version of RadScheduler you will have to update the other connected clients after
    the data is returned from the hub.

    At the moment there is no such ready solution project for this scenario so you could submit your solution for a new Code Library here.

    Regards,
    Plamen
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  11. Lachezar
    Lachezar avatar
    1 posts
    Member since:
    Mar 2014

    Posted 07 Apr 2014 in reply to Costas Link to this post

    Hi Costas,

    I'm new to Telerik controls and I'm trying to implement same SignalR functionality as you (refresh/rebind scheduler for all clients when new appointment is created) and was wondering if you could point me in the right direction. Any sample code would be greatly appreciated.

    Thanks,

    -Lach
  12. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Apr 2014 in reply to Lachezar Link to this post

    Hi Lachezar,

    With reference to this forum thread the Radscheduler doesn't supports Client-Side rebinding. O one suggestion is that you can use RadAjaxManager.

    Thanks,
    Princy.
  13. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 10 Apr 2014 Link to this post

    Hi Lachezar,

    Unfortunately the current version of RadScheduler does not support integration with SignalR. I have created a feature request and we will do our best to add it as soon as possible. You can follow it and vote for it here.

    Regards,
    Plamen
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  14. Kalpna
    Kalpna avatar
    37 posts
    Member since:
    Jun 2013

    Posted 27 Jun 2014 Link to this post

    Hello All,

    I have a problem in RadSchedulerRecurrenceEditor. I have code the app according to the client requirement. On Local project with its local database RadScheduler With Recurrence Editor works fine. But On live it produce a problem in RadSchedulerRecurrenceEditor(It does not provide proper recurrence rule and and even does not save my activity of RadScheduler and i have also not applied any condition that RecurrenceRule is necessary.At least it should save my activity. But it does not. when i want to schedule an activity with no end date. And when i tried with count then it does not take proper count which i have set.) To check it i have also connected the live database with my project and tried to find out the problem. But there is no problem. It works fine as i want with my local project and live database. But on live(Project as well as Database) it produce this problem. It also does not providing any error. But does not provide result according to my requirement.

    I thought there was a problem with dll. But i also again upload it. But same problem occurs.

    Please provide me the solution for this. I am unable to find out this type of error. It is urgent for me. 

  15. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 30 Jun 2014 Link to this post

    Hello Kalpna,

    From the explanation provided it is not quite clear how to replicate the unusual behavior. We are also not aware of such known issue with RadScheduler. Would you please elaborate a little bit the steps that have to be made and the code used  so we can observe the wrong behavior and be more helpful.

    Regards,
    Plamen
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  16. David
    David avatar
    37 posts
    Member since:
    Aug 2014

    Posted 23 Oct 2014 in reply to Jayesh Goyani Link to this post

    I am experiencing the same issue where my RadScheduler is declaratively bound. I have a call to RadScheduler.Rebind and I also have added the AJAX manager code referenced above.

    While it appears that the scheduler is properly adding appointments based on the rebind, the existing appointments are not removed.
     If the user manually deletes the appointments on the client, they do not return {as they didn't exist in the underlaying data already}

    I have attempted to cycle through the appointments and call appointment.dispose and that didn't work.

    Thoughts?
  17. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 28 Oct 2014 Link to this post

    Hi David,

    Would you please provide the exact code used with RadScheduler  to observe the unusual issue so we could inspect it locally and be more helpful?

    Regards,
    Plamen
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  18. David
    David avatar
    37 posts
    Member since:
    Aug 2014

    Posted 28 Oct 2014 in reply to Plamen Link to this post

    I trimmed down where the issue is. The scheduler retains the appointments when the new databind event has no records returned.

    I haven't tried yet, but I will attempt to clear the collection prior to databinding.
  19. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 29 Oct 2014 Link to this post

    Hi David,

    Thank you for sharing the status of the issue. It sounds like quite an unusual behavior so if you success isolating it please share the steps to reproduce it so we could log it for fixing.

    Regards,
    Plamen
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  20. David
    David avatar
    37 posts
    Member since:
    Aug 2014

    Posted 30 Oct 2014 in reply to Plamen Link to this post

    <chagrin>

    No need to log the fix. It helps if the programmer puts the grid.databind *outside* of the  If(table.rows > 0) segment...

    Unusual behavior is now gone!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017