将ajaxToolkit:ToolkitScriptManager与asp:ScriptManager一起使用
我正在尝试在我的content.aspx页面中使用ajaxToolkit:CalendarExtender。问题是我的site.master页中有一个asp:ScriptManager标记。如何使用ScriptManagerProxy替换我的content.aspx页面中的ajaxToolkit:ToolkitScriptManager *下面的代码是我的站点。Master* *下面的代码是my content.aspx*将ajaxToolkit:ToolkitScriptManager与asp:ScriptManager一起使用,ajax,ajaxcontroltoolkit,Ajax,Ajaxcontroltoolkit,我正在尝试在我的content.aspx页面中使用ajaxToolkit:CalendarExtender。问题是我的site.master页中有一个asp:ScriptManager标记。如何使用ScriptManagerProxy替换我的content.aspx页面中的ajaxToolkit:ToolkitScriptManager *下面的代码是我的站点。Master* *下面的代码是my content.aspx* 我确实为此找到了一个解决办法,尽管我不确定它是否理想。对于那些同样有这个
我确实为此找到了一个解决办法,尽管我不确定它是否理想。对于那些同样有这个问题的人,我确实通过添加第二个母版页来实现这一点,在ScriptManagerProxy之前我启动了ToolScriptManager。第二个Site.Master只使用ScriptManagerProxy。问题似乎是我无法在我的内容页面中使用ScriptManagerProxy来为使用ToolScriptManager的AJAX控件提供服务。在我找到更好的方法之前,这会起作用的。下面是我的代码供其他人参考 *Site-AJAX.Master* 不需要ToolScriptManager的内容页的Site.Master 另外,不要忘记将工具箱添加到web.config文件中
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="cms.master.cs" Inherits="ccib.cms" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %>>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/Content/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManagerProxy1" runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--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>
<div class="container">
<div class="row">
<nav class="navbar navbar-default" role="navigation">
</nav>
</div>
</div>
<div class="container">
<div class="row">
<div class="container body-content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
<div class="row">
<footer>
<p> © <%: DateTime.Now.Year %> </p>
</footer>
</div>
</div>
</form>
</body>
</html>
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Content.aspx.cs" Inherits="ccib.mycms.Content" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
<asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender
ID="CalendarExtender2"
TargetControlID="txtStartDate"
Format="dd/MM/yyyy"
runat="server">
</ajaxToolkit:CalendarExtender>
</asp:Content>
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ></ajaxToolkit:ToolkitScriptManager>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--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:ScriptManagerProxy>
<asp:ScriptManager ID="ScriptManagerProxy1" runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--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>
<configuration>
<system.web>
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
</configuration>