9

I created a new project. I installed Ajax Control Toolkit from NuGet. Then I created a new page aspx with following code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <ajaxToolkit:ToolkitScriptManager ID="toolkitScriptMaster" runat="server">
        </ajaxToolkit:ToolkitScriptManager>
       hello!!!!

    </div>
    </form>
</body>
</html>

I was dumbfounded when I saw that ajaxtookit created 152 scriptresources files. I am worried because I know that this can affect the loading time of the page.

Is it normal?

What can I do?

POIR
  • 3,110
  • 9
  • 32
  • 48
  • Find jQuery/JavaScript alternatives to the functionality you need. Microsoft has abandoned the toolkit and it currently is maintained as an open source project. – Karl Anderson Oct 31 '13 at 15:36
  • I use a mixture of the ajaxControlToolkit and jQuery and I know that it is not normal for 150 scriptresource files to be installed. Where are these files being installed at? – Humpy Oct 31 '13 at 15:47
  • I have the same problem happening on a .net 3.5 website. The resources are 150 calls to scriptresource.axd for various javascript resources. Why aren't those all in one script? These many calls cannot be good for the server. – ceetheman Nov 21 '13 at 18:28

1 Answers1

17

CodePlex's AjaxControlToolkit release of July 2013 introducing control bundles.

After this by default AjaxControlToolkit loads all scripts. So, to manage what scripts for what controls should be added and grouped you need to add AjaxControlToolkit.config to root of your web application project. Like in the following example:

<ajaxControlToolkit>
  <controlBundles>
    <controlBundle>
      <control name="CalendarExtender" />
      <control name="ComboBox" />
        </controlBundle>
    <controlBundle name="CalendarBundle">
      <control name="CalendarExtender"></control>
    </controlBundle>
  </controlBundles>
</ajaxControlToolkit>

Then you will need to specify which bundels are going to be used on which page (or master page if you have controls which are used on all pages) by adding bundle with specific name to toolkit script manager control:

<ajaxToolkit:ToolkitScriptManager runat="server" CombineScripts="true" 
  ScriptMode="Release" >
  <ControlBundles>
       <ajaxToolkit:ControlBundle Name="Calendar" />
  </ControlBundles>
</ajaxToolkit:ToolkitScriptManager>

Remarks: here you can find example of the config which contains most (maybe all definition of the controls from ajax control toolkit library).

Maxim Kornilov
  • 5,675
  • 1
  • 24
  • 35