我正在尝试从 AJAXTool 工具包中添加 CalenderExternder 功能。当我将控件添加到我的页面、构建和调试时,我收到以下错误:
无法修改 Controls 集合,因为该控件包含代码块(即 <% ... %>)。
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Web.HttpException:无法修改 Controls 集合,因为该控件包含代码块(即 <% ... %>)。
源错误:在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。
堆栈跟踪:[HttpException (0x80004005):无法修改 Controls 集合,因为该控件包含代码块(即 <% ... %>)。] System.Web.UI.ControlCollection.Add(Control child) +9600379 AjaxControlToolkit。 ScriptObjectBuilder.RegisterCssReferences(控制控件) +702 AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) +62 System.Web.UI.Control.LoadRecursive() +54 System.Web.UI.Control.LoadRecursive() +145 System.Web. UI.Control.LoadRecursive() +145 System.Web.UI.Control.LoadRecursive() +145 System.Web.UI.Control.LoadRecursive() +145 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint ) +772
这是我的整个页面代码,只要我的代码中没有标签,它就可以正常工作。我已经在我的 web.config 文件中注册了工具包,并且母版页正在使用 ToolkitScriptManager
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/AdminLayout.Master" AutoEventWireup="true" CodeBehind="ManageReleaseInfo.aspx.cs" Inherits="FFInfo.Staff.Sections.ManageReleaseInfo" %>
<asp:Content ID="phContent" ContentPlaceHolderID="phContent" runat="server">
<h2 class="text-center">
<asp:Literal ID="lblTitle" runat="server" />
</h2>
<asp:Label ID="lblResults" CssClass="text-error" runat="server" />
<asp:ValidationSummary ID="vsErrorSummary" CssClass="text-error" DisplayMode="BulletList" HeaderText="The following errors have been found:" runat="server" />
<p>
What section is this for?
<asp:DropDownList ID="ddlSectionList" AppendDataBoundItems="true" runat="server">
<asp:ListItem Value="-1" Text="Select Section Title" />
</asp:DropDownList>
<br />Release Title:
<asp:TextBox ID="tbReleaseTitle" Columns="50" runat="server" />
<asp:RequiredFieldValidator ID="ReleaseTitleRequired" ControlToValidate="tbReleaseTitle" Display="Dynamic" CssClass="text-error" Text="*" ErrorMessage="Please there the release title." runat="server" />
<br />Platform:
<asp:DropDownList ID="ddlPlatform" AppendDataBoundItems="true" runat="server">
<asp:ListItem Value="-1" Text="Select Platform" />
</asp:DropDownList>
<br />Publisher:
<asp:DropDownList ID="ddlPublisher" AppendDataBoundItems="true" runat="server">
<asp:ListItem Value="-1" Text="Select Publisher" />
</asp:DropDownList>
<br />Release Location:
<asp:DropDownList ID="ddlLocation" AppendDataBoundItems="true" runat="server">
<asp:ListItem Value="-1" Text="Select Locaiton" />
</asp:DropDownList>
<br />Estimated Release Date:
<asp:DropDownList ID="ddlReleaseDate" AppendDataBoundItems="true" runat="server">
<asp:ListItem Value="-1" Text="Select Estimated Date" />
</asp:DropDownList>
<br />Exact Release Date:
<asp:TextBox ID="tbReleaseDate" AutoCompleteType="Disabled" runat="server" />
<asp:CalendarExtender ID="ceReleaseDate" TargetControlID="tbReleaseDate" runat="server" />
<asp:RegularExpressionValidator ID="ReleaseDateCheck" ControlToValidate="tbReleaseDate" ValidationExpression="^([0-9]{1,2})[./-]+([0-9]{1,2})[./-]+([0-9]{2}|[0-9]{4})$" Display="None" ErrorMessage="Please enter a valid date in MM/DD/YYYY format please." runat="server" />
</p>
</asp:Content>