ASP:ScriptManager的,那是什么? [英] ASP:ScriptManager, what is that?
问题描述
我希望这是好的张贴第三跟进的问题。原来的问题都可以在这里找到:<一href=\"http://stackoverflow.com/questions/23788212/jquery-datepicker-not-working-with-masterpage/23788423?noredirect=1#comment36586473_23788423\">jQuery DatePicker的不与母版工作
很长时间的调查后,原来有什么不对JavaScript的code在所有。相反,会出现问题,当你使用现有的模板,(我使用的是2013年)创建在Visual Studio中一个新的项目,在母版,你会发现C $ CS如下一串$:
&LT; ASP:的ScriptManager =服务器&GT;
&LT;脚本和GT;
&LT;% - 框架脚本 - %GT;
&LT; ASP:的ScriptReference NAME =MsAjaxBundle/&GT;
&LT; ASP:的ScriptReference NAME =jQuery的/&GT;
&LT; ASP:的ScriptReference名称=引导/&GT;
&LT; ASP:的ScriptReference名称=响应/&GT;
&LT; ASP:的ScriptReference NAME =WebForms.js大会=System.Web程序PATH =〜/脚本/的WebForms / WebForms.js/&GT;
&LT; ASP:的ScriptReference NAME =WebUIValidation.js大会=System.Web程序PATH =〜/脚本/的WebForms / WebUIValidation.js/&GT;
&LT; ASP:的ScriptReference NAME =MenuStandards.js大会=System.Web程序PATH =〜/脚本/的WebForms / MenuStandards.js/&GT;
&LT; ASP:的ScriptReference NAME =GridView.js大会=System.Web程序PATH =〜/脚本/的WebForms / GridView.js/&GT;
&LT; ASP:的ScriptReference NAME =DetailsView.js大会=System.Web程序PATH =〜/脚本/的WebForms / DetailsView.js/&GT;
&LT; ASP:的ScriptReference NAME =TreeView.js大会=System.Web程序PATH =〜/脚本/的WebForms / TreeView.js/&GT;
&LT; ASP:的ScriptReference NAME =WebParts.js大会=System.Web程序PATH =〜/脚本/的WebForms / WebParts.js/&GT;
&LT; ASP:的ScriptReference NAME =Focus.js大会=System.Web程序PATH =〜/脚本/的WebForms / Focus.js/&GT;
&LT; ASP:的ScriptReference NAME =WebFormsBundle/&GT;
&LT;% - 站点脚本 - %GT;
&LT; /脚本&GT;
&LT; / ASP:ScriptManager的&GT;
当我删除整个codeS上面,我所有的jQuery的功能似乎再次合作,神奇。
现在我的问题是:
- 什么是对的ScriptManager?
- 为什么会影响我的jQuery UI的DatePicker的?
- 如果我删除这些线路,它将如何影响项目?
- 如果有,我怎么解决这个问题?
脚本管理器是包含和管理脚本文件的.NET方法。我会说他们不是在脚本经理预期DIR找到他们的前4不必对文件的路径。
我想说的路径添加到第4在那里,看看他们是否就能够找到这些文件。
这里有几个例子/教程使用脚本经理给你一个更好的主意
一个简单的ajax例子
从asp.net 复杂的扩展解释
I hope this is okay for posting a third follow up question. Original issues can be found here: jQuery DatePicker not working with Masterpage
After a very long investigation, turns out there is nothing wrong with the JavaScript code at all. Instead, the problem occur when you created a new project in Visual Studio using the existing template, (I'm using 2013), in the Masterpage, you will find a bunch of codes as below:
<asp:ScriptManager runat="server">
<Scripts>
<%--Framework Scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
<%--Site Scripts--%>
</Scripts>
</asp:ScriptManager>
When I deleted the entire codes above, all of my jQuery functions seem to be working again, "magically".
Now my questions are:
- What is the ScriptManager for?
- Why is it affecting my jQuery UI DatePicker?
- If I remove those lines, how will it affect the project?
- If yes, how do I resolve the issues?
script manager is a .net way of including and managing your script files. i would say they are not in the expected dir for the script manager to find them as the first 4 do not have a path to the files.
I would say to add the path to the first 4 in there and see if they are then able to find the files.
here are a couple of examples / tutorials for using script managers to give you a better idea one simple ajax example
the complicated extended explanation from asp.net
这篇关于ASP:ScriptManager的,那是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!