C# 扩展程序不能位于与其扩展的控件不同的UpdatePanel中

C# 扩展程序不能位于与其扩展的控件不同的UpdatePanel中,c#,asp.net,C#,Asp.net,我正在使用更新面板。在这里,当某些条件与下拉值选择匹配时,我必须动态启用正则表达式验证器 这是我的设计: <asp:UpdatePanel ID="UpdatePanel20" runat="server"> <ContentTemplate> <asp:Panel ID="Panel_Search" runat="server" Width="100px" DefaultButton="btnsearch"> <table> <tr>

我正在使用更新面板。在这里,当某些条件与下拉值选择匹配时,我必须动态启用正则表达式验证器

这是我的设计:

<asp:UpdatePanel ID="UpdatePanel20" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel_Search" runat="server" Width="100px" DefaultButton="btnsearch">
<table>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel15" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="DDL_Column_List" runat="server" 
AppendDataBoundItems="true" Width="120px" ValidationGroup="Search" AutoPostBack="True">
<asp:ListItem Value="-1">Select Column</asp:ListItem>
</asp:DropDownList>
</ContentTemplate>

<Triggers>
<asp:AsyncPostBackTrigger ControlID="DDL_Column_List" 
EventName="SelectedIndexChanged" />
</Triggers>

</asp:UpdatePanel>
</td>
<td>&nbsp;</td>
<td><asp:TextBox ID="txtsearch" runat="server" CssClass="input" 
ValidationGroup="Search"></asp:TextBox>
<asp:RegularExpressionValidator id="RegularExpressionValidator5" runat="server" 
                    ValidationGroup="Search" 
SetFocusOnError="true" ControlToValidate="txtsearch" 
                    ValidationExpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$" 
                    Display="None" Enabled="False"></asp:RegularExpressionValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender20" runat="server" TargetControlID="RegularExpressionValidator5" WarningIconImageUrl="~/images/Warning.gif" CloseImageUrl="~/images/close.gif" >
</ajaxToolkit:ValidatorCalloutExtender>
</td>
<td><asp:Button ID="btnsearch" runat="server" Text="Search" CssClass="button" 
onclick="btnsearch_Click" ValidationGroup="Search"/></td>
</tr></table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
然而,当加载此页面时,会出现一个运行时错误,如:

Server Error in '/CRM' Application.

An extender can't be in a different UpdatePanel than the control it extends.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: An extender can't be in a different UpdatePanel than the control it extends.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[InvalidOperationException: An extender can't be in a different UpdatePanel than the control it extends.]
   System.Web.UI.ExtenderControl.RegisterWithScriptManager() +443813
   System.Web.UI.ExtenderControl.OnPreRender(EventArgs e) +19
   AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) +36
   AjaxControlToolkit.ValidatorCalloutExtender.OnPreRender(EventArgs e) +124
   System.Web.UI.Control.PreRenderRecursiveInternal() +103
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
我怎么了。。
请帮助我…

您是否有其他updte面板,或者您是否可以发布完整的aspx页面?这可能有点过时,但为什么要禁用验证程序,为什么要将错误消息放在代码中?不管怎样,我认为问题在于,因为如果你删除它,它会在添加ScriptManager obvi后工作。@Jameem-ya我在modal popup extender中有4个更新面板。我认为问题不在于你粘贴的代码部分。我复制了它并检查了它。在我的情况下,它不会给出任何错误。如果设计部分有问题,我怎么知道呢。
Server Error in '/CRM' Application.

An extender can't be in a different UpdatePanel than the control it extends.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: An extender can't be in a different UpdatePanel than the control it extends.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[InvalidOperationException: An extender can't be in a different UpdatePanel than the control it extends.]
   System.Web.UI.ExtenderControl.RegisterWithScriptManager() +443813
   System.Web.UI.ExtenderControl.OnPreRender(EventArgs e) +19
   AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) +36
   AjaxControlToolkit.ValidatorCalloutExtender.OnPreRender(EventArgs e) +124
   System.Web.UI.Control.PreRenderRecursiveInternal() +103
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1