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?
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).
来源:https://stackoverflow.com/questions/19710731/ajax-control-toolkit-is-loading-too-many-script-resources