ASP.NET:CollapsiblePanelExtender不适用于UserControl

时间:2010-03-02 10:52:22

标签: asp.net ajax user-controls

尝试使用名为CheckBoxControl的UserControl作为CollapsiblePanelExtender的ExpandControlID / CollapseControlID属性的值。当我使用普通的CheckBox时,它工作正常。

<uc:CheckBoxControl ID="ucHaftpflicht" runat="server" OnCheckedChanged="UpdateStatus" ControlLabel="Haftpflicht" />           
<asp:Panel ID="HaftpflichtPanel" runat="server">
       ...
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender" runat="server" CollapseControlID="ucHaftpflicht.CheckBox" ExpandControlID="ucHaftpflicht.CheckBox"  TargetControlID="HaftpflichtPanel" />

当我运行该网站时,我网站上的大多数ajax控件都会消失,我在firefox脚本错误控制台中出现以下错误:

  • Fehler:Sys.InvalidOperationException:未通过Sys.UI.DomEvent.addHandler方法添加处理程序。

  • Fehler:Sys.ArgumentException:找不到元素“ucHaftpflicht.CheckBox” 参数名称:CollapseControlID

1 个答案:

答案 0 :(得分:2)

通过UserControl中的getter公开复选框,并在页面的代码隐藏中将CollapsiblePanelExtender折叠/展开控件ID分配给ucHaftpflicht.MyCheckBox.ClientID

相关问题