How to replase ScriptManager by RadScriptManager?

7 posts, 0 answers
  1. Oleg
    Oleg avatar
    12 posts
    Member since:
    Jul 2012

    Posted 09 Nov 2012 Link to this post

    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);
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Nov 2012 Link to this post

    Hi,

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

    Thanks,
    Shinu.
  3. Oleg
    Oleg avatar
    12 posts
    Member since:
    Jul 2012

    Posted 12 Nov 2012 Link to this post

    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? 
  4. Plamen
    Admin
    Plamen avatar
    2969 posts

    Posted 16 Nov 2012 Link to this post

    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.
  5. Oleg
    Oleg avatar
    12 posts
    Member since:
    Jul 2012

    Posted 16 Nov 2012 Link to this post

    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>
  6. Plamen
    Admin
    Plamen avatar
    2969 posts

    Posted 21 Nov 2012 Link to this post

    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.
  7. Oleg
    Oleg avatar
    12 posts
    Member since:
    Jul 2012

    Posted 21 Nov 2012 Link to this post

    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.
Back to Top