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

RadScheduler rebind problem

18 Answers 568 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Subodh Gupta
Top achievements
Rank 2
Subodh Gupta asked on 19 Aug 2013, 11:03 AM
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

18 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 21 Aug 2013, 11:10 AM
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
0
Subodh Gupta
Top achievements
Rank 2
answered on 22 Aug 2013, 05:13 PM
Hello Jayesh,

Thanks for help! It's work!
0
Kalpna
Top achievements
Rank 1
answered on 28 Dec 2013, 11:30 AM
Hii Jayesh,
Is it possible to rebind Rad-Scheduler without using Ajax.
0
Plamen
Telerik team
answered on 30 Dec 2013, 06:53 AM
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.
0
Kalpna
Top achievements
Rank 1
answered on 30 Dec 2013, 07:27 AM
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.
0
Plamen
Telerik team
answered on 01 Jan 2014, 01:50 PM
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.
0
Costas
Top achievements
Rank 1
answered on 23 Jan 2014, 12:52 AM
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
0
Plamen
Telerik team
answered on 28 Jan 2014, 06:10 AM
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.
0
Lachezar
Top achievements
Rank 1
answered on 07 Apr 2014, 09:27 PM
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
0
Princy
Top achievements
Rank 2
answered on 08 Apr 2014, 12:21 PM
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.
0
Plamen
Telerik team
answered on 10 Apr 2014, 09:28 AM
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.

 
0
Kalpna
Top achievements
Rank 1
answered on 27 Jun 2014, 11:13 AM
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. 

0
Plamen
Telerik team
answered on 30 Jun 2014, 10:52 AM
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.

 
0
David
Top achievements
Rank 1
answered on 23 Oct 2014, 06:29 PM
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?
0
Plamen
Telerik team
answered on 28 Oct 2014, 03:00 PM
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.

 
0
David
Top achievements
Rank 1
answered on 28 Oct 2014, 06:39 PM
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.
0
Plamen
Telerik team
answered on 29 Oct 2014, 02:26 PM
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.

 
0
David
Top achievements
Rank 1
answered on 30 Oct 2014, 01:45 PM
<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!
Tags
Scheduler
Asked by
Subodh Gupta
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
Subodh Gupta
Top achievements
Rank 2
Kalpna
Top achievements
Rank 1
Plamen
Telerik team
Costas
Top achievements
Rank 1
Lachezar
Top achievements
Rank 1
Princy
Top achievements
Rank 2
David
Top achievements
Rank 1
Share this question
or