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

How to replase ScriptManager by RadScriptManager?

6 Answers 338 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 09 Nov 2012, 10:53 PM
I am trying to remove ScriptManager and add RadScriptManager to my page from SharePoint Web Part. For some reason my code does not work. I still getting "Only one instance of a ScriptManager can be added to the page." What is right approach to replace ScriptManager?

 

ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
if (scriptManager != null)
   {
       Page.Form.Controls.Remove(scriptManager);
   }
 
RadScriptManager radScriptManager = new RadScriptManager();
this.Page.Form.Controls.AddAt(0, radScriptManager);

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Nov 2012, 06:02 AM
Hi,

Check the following help documentation which explains how to add RadScriptManager.
RadScriptManager

Thanks,
Shinu.
0
Oleg
Top achievements
Rank 1
answered on 12 Nov 2012, 05:59 PM
Thank you for response.

Instead to add RadScriptManager from my web part I added RadScriptManager to Master page. After that I am getting the java script error "'length is null or not an object' in ScriptResource.axd Line:653" on every SharePoint page. I double checked <handlers> configuration and it looks fine. What is right approach to enable RadScriptManager on SharePoint 2010 site? 
0
Plamen
Telerik team
answered on 16 Nov 2012, 06:21 AM
Hello Oleg,

 
We have inspected the error that you described but we don't have a ready information about it. Would you please share more details what is the code that should be used in order to reproduce it locally?

You can also review this help topic where more information is provided in case you have missed something.

Hope this will be helpful.
 

Greetings,
Plamen
the Telerik team
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 their blog feed now.
0
Oleg
Top achievements
Rank 1
answered on 16 Nov 2012, 03:13 PM
Thank you for response.

I used the article "Create an AJAX-enabled SharePoint WebPart that uses RadControls" on my MOSS 2007 environment and it was working perfect but now I am creating smart web parts for SharePoint 2010 and this approach does not work. Ajax is enabled on SharePoint 2010 by default and ScriptManager is already placed in master page. My understending RadAjaxManager+LoadingPanel+RadGrid do not working with ScripManager I have to use RadScriptManager instead. If I simply replacing ScriptManager in master page on RadScriptManager I am getting java script error "'length is null or not an object' in ScriptResource.axd Line:653" on every SharePoint page. My question is how to configure RadScriptManager on SharePoint 2010? I was using RadAjax controls on MOSS 2007 and in ASP.NET applications without any issues. My issue is just with SharePoint 2010.

<telerik:RadScriptManager ID="rsmFileUpload" runat="server"
</telerik:RadScriptManager>
  
<telerik:RadAjaxManager ID="ramFileUpload" runat="server"
  <AjaxSettings>
     <telerik:AjaxSetting AjaxControlID="btnAdd"
       <UpdatedControls>
         <telerik:AjaxUpdatedControl ControlID="rgDocuments" LoadingPanelID="panelProcessing" />
       </UpdatedControls>
     </telerik:AjaxSetting>             
  </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadAjaxLoadingPanel ID="panelProcessing" runat="server"
</telerik:RadAjaxLoadingPanel>
0
Plamen
Telerik team
answered on 21 Nov 2012, 01:11 PM
Hi Oleg,

 
I have investigated the issue deeper. First of all I would like to clarify that all RadControls (including RadAjaxManager+LoadingPanel+RadGrid ) can work with ScriptManager and do not need replacing with RadScriptManager at all. The unusual behavior you are experiencing is most probably caused by a known issue in SharePoint where SP 2010 was failing to load scripts on an ajax request. That is why I will recommend you to upgrade to the latest cumulative update of the SharePoint 2010 server - it came out at the end of October. The cumulative pack contained a fix for the issue
 
Hope this will be helpful.

All the best,
Plamen
the Telerik team
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 their blog feed now.
0
Oleg
Top achievements
Rank 1
answered on 21 Nov 2012, 06:05 PM
Thank you,

I just restored out of box Master page with ScriptManager and all my error were gone. Looks like the issue was in RadScripManager in master page.
Tags
Ajax
Asked by
Oleg
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Oleg
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or