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

asp:UpdatePanel and radScheduler issues

15 Answers 397 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Alberto
Top achievements
Rank 1
Alberto asked on 30 Aug 2010, 03:37 PM
Hello,

i´m develping a small webpart, and i´m having some issues when i use the radScheduler with the asp:UpdatePanel.
The webpart has one radScheduler and a few cotrols more, but not many. 

Hte scheduler is inside an updatePanel when an event happens like when i click on the header to change the view (day, weeks, or months) a javascript error display saying b.Month.Model or b.TimeLine.Model is null or not an object. After that the control doesn´t render properly and it doesn´t work as expected.

I´ve tried different ways and small examples but i can´t fix it.

Here is the source code, is quite simple...

<

 

 

asp:UpdatePanel runat="server" UpdateMode="Conditional">

 

 

 

<ContentTemplate>

 

 

 

<telerik:RadScheduler runat="server" ID="SchedulerPrueba" ShowHeader="true"

 

 

 

DataKeyField="Id"

 

 

 

DataSubjectField="Subject"

 

 

 

DataStartField="EventDate"

 

 

 

DataEndField="EndDate"

 

 

 

>

 

 

 

</telerik:RadScheduler>

 

 

 

</ContentTemplate>

 

 

 

</asp:UpdatePanel>

 

 

 Nothing on the code-behind

Thanks

15 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 03 Sep 2010, 02:29 PM
Hello Alberto,

This is a known issue with ScriptManager in SharePoint - controls can't register scripts on the fly and RadScheduler uses exactly such scripts.

We don't have a reliable solution for now, but we have a few workarounds. The first one is to register the control scripts manually and set SchedulerPrueba.EnableEmbeddedScripts = false. See the attached snippet.

One other thing that you can try is to call EnsureChildControls in OnInit:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    EnsureChildControls();
}

We're researching for a proper solution meanwhile, but so far we don't have much luck.

I hope this helps.

Best wishes,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dasha
Top achievements
Rank 1
answered on 07 Sep 2010, 04:17 PM
Tsvetomir, thank you for your help in this issue.

I have tried theEnsureChildControls method, and it didn't work for me.  And unfortunately it does not seem like the Script Manager approach is fitting as well.  Or maybe I'm missing something.  The problem is that the web part requires that I have a ScriptManager control on the page in order to work properly, and placing a RadScriptManager on the user control page creates a conflict.  So I thought that maybe I can use the web part's script manager to register the scripts in the web part class, and I still had no luck getting it to work - basically I can switch a view only once, and after that I get no reaction.
0
T. Tsonev
Telerik team
answered on 08 Sep 2010, 07:26 AM
Hello Dasha,

Using the existing ScriptManager instance will work fine - obtain a reference by calling ScriptManager.GetCurrent(Page). Make sure you register the scripts on each request.

What is the error message you see when you switch views?

Kind regards,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dasha
Top achievements
Rank 1
answered on 08 Sep 2010, 04:59 PM
Hmm, maybe I'm not registering the scripts in the right page event.  Where do you recommend I place the calls?  I will try it out again tomorrow.
0
Dasha
Top achievements
Rank 1
answered on 13 Sep 2010, 05:21 PM

Ok, here's my progress report:
I'm currently registering the scripts in the web part class, in the protected override void OnLoad(EventArgs e) event.  The script registration looks like this:

ScriptManager scriptManager = ScriptManager.GetCurrent(Page); 
                if (scriptManager != null
                
                    string telerikAssembly = typeof(RadScheduler).Assembly.FullName; 
                    scriptManager.Scripts.Add(new ScriptReference("Telerik.Web.UI.Common.Core.js", telerikAssembly)); 
//...And so on

By the way, I had to add one more script to the registration from your example, otherwise the context menu was not working properly.  The Telerik.Web.UI.Scheduler.ContextMenu.RadScheduler.ContextMenu.js was missing.

I'm seeing the following behavior:
- Sharepoint 2010:
    - if i have the dubbuger on, then this error is caught:
    

Webpage error details
  
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Mon, 13 Sep 2010 16:17:27 UTC
  
  
Message: Sys.InvalidOperationException: Two components with the same id 'ctl00_m_g_b04b5ece_fbd4_4f78_b65d_5f172766d6d5_ctl00_CWCalendar_SelectedDateCalendar' can't be added to the application.
Line: 4044
Char: 59
Code: 0
URI: http://win-dwsgqbxiuwm/ScriptResource.axd?d=MKkwUF8aaV_gwl_p_2wR9BiN2hfwkJ4UaaNemv6ltcPZ26LYFaw8Su-gSY0yVw56fhh_gZoP9IOKd6bkBRGOhOyeSQbUL67_yrjfeJaOgkw1&t=ffffffffba2f01c1

and then the page works okay.
    - if i don't have the debugger on, then the page loads with a js error notification at the bottom.  on a wiki page it's the same error as above, and on a web part page, the error is this:
    

Webpage error details
  
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Mon, 13 Sep 2010 15:58:24 UTC
  
  
Message: 'this._viewIDs.length' is null or not an object
Line: 259
Char: 32
Code: 0
URI: http://win-dwsgqbxiuwm/ScriptResource.axd?d=QXIXrIbLbks8YJyEE126-0FiP0kHQOjSCMxUHpU0i0p8XVtpWvfo7OJQ0m_oldLVNNoRsN7OGw8rSg6MUvCJZI9Kf5h-79x1JnipJbwyf6VAKat3iVInqmOnmjAcULI10&t=3bacbfee

and the view will switch only once.

- Sharepoint 2007:
    - the loading panel callback does not work at all, the views switch through a post back.  no js error occurrs.

0
T. Tsonev
Telerik team
answered on 14 Sep 2010, 04:05 PM
Hi Dasha,

Thank you for the update.

It seems that SharePoint 2010 doesn't call the dispose method of the client-side control objects. We'll try to reproduce the issue locally and we'll get back to you.

I hope we'll be able to work around those SharePoint quirks.

Greetings,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dasha
Top achievements
Rank 1
answered on 14 Sep 2010, 05:03 PM
Thank you so much for working on this issue with me.  Do you have any thoughts about the weird SharePoint 2007 behavior?  I know that the loading panel works in that environment because we use it with a number of other components, including the RadGrid, but it seems to be completely ignoring the ajax presence and doing a regular postback.
0
Alberto
Top achievements
Rank 1
answered on 21 Sep 2010, 10:10 AM
Hi,

i have another issue to fix, it´s about the navigation command on the week and month view, when the user clicks on the date it fires the following error.

_switchToSelectedDay:function(l){var l=f.getDate(l);
var j=new h.NavigationCommandEventArgs(b.SchedulerNavigationCommand.SwitchToSelectedDay,l);
this.raiseEvent("NavigationCommand",j);

Because f is null, there is any way to fix this because i´m also trying to cath the event OnClientNavigationCommand but i can´t.



0
T. Tsonev
Telerik team
answered on 21 Sep 2010, 10:38 AM
Hello Dasha,

Apologies for the late reply.

I tried few different set-ups, but I always got correct behavior - partial updates worked and I didn't get JavaScript errors in SP2010. I'm attaching you the web part source code for reference.

Are you sure that you're using the correct assembly version? It should end with .35 for SP2010.

Alberto, the problem is caused by a mistake that I've made when listing the scripts that RadScheduler requires. The Helpers.DateTime.js must be the first one of the Scheduler scripts. Here's the correct script list, including the correction from Dasha:

Telerik.Web.UI.Common.Core.js
Telerik.Web.UI.Common.jQuery.js
Telerik.Web.UI.Common.jQueryPlugins.js
Telerik.Web.UI.Common.Popup.PopupScripts.js
Telerik.Web.UI.Common.Navigation.NavigationScripts.js
Telerik.Web.UI.Menu.RadMenuScripts.js
Telerik.Web.UI.Menu.ContextMenu.RadContextMenuScripts.js
Telerik.Web.UI.Input.TextBox.RadInputScript.js
Telerik.Web.UI.Input.DateInput.RadDateInputScript.js
Telerik.Web.UI.Input.NumericTextBox.RadNumericInputScript.js
Telerik.Web.UI.Calendar.RadTimeViewScripts.js
Telerik.Web.UI.Calendar.RadCalendarCommonScript.js
Telerik.Web.UI.Calendar.RadCalendarScript.js
Telerik.Web.UI.Calendar.RadDatePicker.js
Telerik.Web.UI.Calendar.RadDateTimePickerScript.js
Telerik.Web.UI.ComboBox.RadComboBoxScripts.js
Telerik.Web.UI.Scheduler.Helpers.DateTime.js
Telerik.Web.UI.Scheduler.RadSchedulerScripts.js
Telerik.Web.UI.Scheduler.RecurrenceEditor.RecurrenceEditor.js
Telerik.Web.UI.Scheduler.ContextMenu.RadScheduler.ContextMenu.js
Telerik.Web.UI.Scheduler.Views.Week.Model.js
Telerik.Web.UI.Scheduler.Views.Week.GroupedByResource.Model.js
Telerik.Web.UI.Scheduler.Views.Week.GroupedByDate.Model.js
Telerik.Web.UI.Scheduler.Views.MultiDay.Model.js
Telerik.Web.UI.Scheduler.Views.MultiDay.GroupedByResource.Model.js
Telerik.Web.UI.Scheduler.Views.MultiDay.GroupedByResource.Model.js
Telerik.Web.UI.Scheduler.Views.Day.Model.js
Telerik.Web.UI.Scheduler.Views.Day.GroupedByResource.Model.js
Telerik.Web.UI.Scheduler.Views.Month.Model.js
Telerik.Web.UI.Scheduler.Views.Month.GroupedByResource.Model.js
Telerik.Web.UI.Scheduler.Views.Month.GroupedByDate.Model.js
Telerik.Web.UI.Scheduler.Views.Timeline.Model.js
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByResource.Model.js
Telerik.Web.UI.Scheduler.Views.Timeline.GroupedByDate.Model.js
Telerik.Web.UI.Scheduler.Scheduling.AdvancedTemplate.js

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alberto
Top achievements
Rank 1
answered on 21 Sep 2010, 11:11 AM
Yeah, that´s great finally it´s fixed!!

Thanks a lot for your reply.
0
Dasha
Top achievements
Rank 1
answered on 22 Sep 2010, 01:55 PM
Tsvetomir,

Thank you so much for your help and a great example.  Once I put all the calls into their correct places, the ajax call back and the loading panel worked as expected on SP 2010!  This is great, I'm very excited!  I knew that I had the timing wrong, I just could not figure it out.  What's your verdict on SP 2007?  I still see the page posting back when I switch views, even with your latest changes applied.
0
T. Tsonev
Telerik team
answered on 27 Sep 2010, 12:00 PM
Hi Dasha,

There's a known issue with SP2010 that might be the culprit in your case. Please see this help topic:
http://www.telerik.com/help/aspnet-ajax/create-ajax-enabled-sharepoint-webpart-radcontrols.html

Try adding the code from the help article to the OnInit method to see if that helps.

protected override void OnInit(EventArgs e)
{
   base.OnInit(e);
   Page.ClientScript.RegisterStartupScript(typeof(Web_Part1), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
   if (this.Page.Form != null)
   {
       string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
       if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
       {
           this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
       }
   }
}

Have a nice day.

Sincerely yours,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dasha
Top achievements
Rank 1
answered on 10 Nov 2010, 07:12 PM
Tsvetomir,

Thank you for replying and I apologize for taking so long to get back to you.  I had other projects that were prioritized...

I tried your suggestion in a SharePoint 2007 web part, and it's still doing a full post back instead of an ajax callback when I switch views or go to the next month.  Would it be too much trouble to ask you to try putting together an example of a 2007 web part for me so i can see what I'm doing wrong?
0
Dasha
Top achievements
Rank 1
answered on 12 Nov 2010, 07:27 PM
I have encountered another problem with the Sharepoint 2007 environment that may be related to this issue. I have started a new thread here: http://www.telerik.com/community/forums/aspnet-ajax/scheduler/radtooltipmanager-in-a-sharepoint-2007-web-part.aspx

Not sue if they are related, but figured I'd let you know.
0
T. Tsonev
Telerik team
answered on 16 Nov 2010, 09:28 AM
Hi Dasha,

I've replied to you in the other forum post - let's keep the discussion there is a good chance that both issues are related.

Greetings,
Tsvetomir Tsonev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Scheduler
Asked by
Alberto
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Dasha
Top achievements
Rank 1
Alberto
Top achievements
Rank 1
Share this question
or