Only one instance of a ScriptManager can be added to the page - Dynamic data and DateFilter

595 views Asked by At

I have the datefilter in my dynamic data app where I want to make use of the Ajax Calender Extender. I get the error :-

Only one instance of a ScriptManager can be added to the page

I understand that the master page already has the script manager. I tried using "Asp:ScriptManagerProxy" and didn't work.

Following is my DateFilter.ascx. Any help will be appreciated:-

 <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DateFilter.ascx.cs" Inherits="TestApp.DynamicData.Filters.DateFilter" %>

<%--<Asp:ScriptManagerProxy runat="server" ID="proxy"/>--%>

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">  
</ajaxToolkit:ToolkitScriptManager>

<asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox> 
<asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox> 

<ajaxToolkit:CalendarExtender   
    ID="CalendarExtender1"   
    TargetControlID="txtStartDate"   
    runat="server" />  
<ajaxToolkit:CalendarExtender   
    ID="CalendarExtender2"   
    TargetControlID="txtEndDate"   
    runat="server" />   

Below is the site.master for my dynamic data app

<%@ Master Language="C#" CodeBehind="Site.master.cs" Inherits="TestApp.Site" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Dynamic Data Site</title>
    <link href="~/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <h1 class="DDMainHeader">Test App</h1>
    <div class="DDNavigation">
    <%--    <a runat="server" href="~/"><img alt="Back to home page" runat="server" src="DynamicData/Content/Images/back.gif" />Back to home page</a>--%>
    </div>

    <form id="form1" runat="server">
    <div>
        <%-- TODO: Enable partial rendering by setting the EnablePartialRendering attribute to "true" to provide a smoother browsing experience.
             Leaving partial rendering disabled will provide a better debugging experience while the application is in development. --%>

        <asp:ScriptManager runat="server" EnablePartialRendering="true">
            <Scripts>
                <asp:ScriptReference Name="jquery" />
                <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" />
            </Scripts>
        </asp:ScriptManager>


        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
1

There are 1 answers

2
Matt Whetton On BEST ANSWER

I think if your are using ToolkitScriptManager in your master page you don't need to place anything in your ascx