Ajax控件工具包加载了太多的脚本资源 [英] Ajax Control Toolkit is loading too many script resources

查看:162
本文介绍了Ajax控件工具包加载了太多的脚本资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的项目。从我安装的NuGet Ajax控件工具包。然后,我创建了一个新的ASPX页面与下面code:

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>

当我看到ajaxtookit创建152 scriptresources文件,我傻眼了。
我很担心,因为我知道,这会影响页面的加载时间。

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.

这是正常的?

我能做些什么?

推荐答案

$ C 7月2013 <$的CPLEX的AjaxControlToolkit释放href=\"http://stephenwalther.com/archive/2013/07/25/july-2013-release-of-the-ajax-control-toolkit\">introducing控制束的。

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

这在默认情况下AjaxControlToolkit加载所有脚本之后。因此,要管理什么控制应补充和组合,你需要AjaxControlToolkit.config添加到您的Web应用程序项目的根是什么脚本。像在下面的示例:

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>

然后你需要指定哪些bundels将要通过特定的名称将捆绑到工具箱脚本管理器控制哪些页面(或母版页,如果您有这是在所有页面上使用的控制)上使用的:

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>

注:<一href=\"https://ajaxcontroltoolkit.$c$cplex.com/SourceControl/latest#SampleWebSites/AjaxControlToolkitSampleSite/AjaxControlToolkit.config\">here你可以找到例子包含了大部分的配置(从AJAX控件工具包库的控件也许所有的定义)的。

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

这篇关于Ajax控件工具包加载了太多的脚本资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆