2014-07-10 1 views
0

내 content.aspx 페이지에서 ajaxToolkit : CalendarExtender를 사용하려고합니다. 문제는 내 site.master 페이지 내에 asp : ScriptManager 태그가 있다는 것입니다. ScriptManagerProxy를 어떻게 활용하여 ajaxToolkit : ToolkitScriptManager를 content.aspx 페이지로 대체 할 수 있습니까?ajaxToolkit 사용 : asp로 ScriptkitScriptManager : ScriptManager

*이 코드는 아래에있는 내 site.Master입니다 *

<%@ 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> &copy; <%: 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> 

답변

0

내 content.aspx *입니다 비록 그것이 이상적이라고 확신하지는 않지만. 또한이 문제가 발생하는 경우 ScriptManagerProxy 전에 ToolScriptManager를 시작한 후 두 번째 마스터 페이지를 추가하여이 문제를 해결할 수있었습니다. 두 번째 Site.Master는 ScriptManagerProxy를 사용합니다. 문제는 ToolScriptManager를 사용하는 AJAX 컨트롤을 제공하기 위해 내 콘텐츠 페이지에서 ScriptManagerProxy를 사용할 수 없다는 것입니다. 이 방법이 더 좋은 방법을 찾을 때까지 작동합니다. 아래는 다른 사람들이 참조 할 수있는 코드입니다.

* 사이트 AJAX.Master *

<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> 

Site.Master

<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> 
또한

이 툴킷을 추가하는 것을 잊지 마세요 (콘텐츠 페이지의 경우 ToolScriptManager이 필요 않는) web.config 파일에 추가하십시오.

<configuration> 
    <system.web> 
     <pages> 
      <controls> 
      <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" /> 
      </controls> 
     </pages> 
    </system.web> 
</configuration> 
관련 문제