views:

303

answers:

1

Iam trying to use a UserControl named CheckBoxControl as value for the ExpandControlID/CollapseControlID attributes of the CollapsiblePanelExtender. It works fine when I use a normal CheckBox instead.

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

When I run the site, most ajax controls on my site disappear and I get following errors in firefox script error console:

  • Fehler: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.

  • Fehler: Sys.ArgumentException: Failed to find element "ucHaftpflicht.CheckBox" Parameter name: CollapseControlID

+1  A: 

Expose the checkbox through a getter in your UserControl, and in the code-behind of the page assign the CollapsiblePanelExtender collapse/expand control IDs to ucHaftpflicht.MyCheckBox.ClientID

zincorp
I Hoped there would be a declarative solution instead of a procedural one :)
codymanix