How to set a two buttons for CollapsiblePanelExtender in ASP.NET?
Say, I have panel with Image and a text separated by some text. I want my Image and a text to be the trigger to expand/collapse my Panel.
How to set a two buttons for CollapsiblePanelExtender in ASP.NET?
Say, I have panel with Image and a text separated by some text. I want my Image and a text to be the trigger to expand/collapse my Panel.
Add ImageButtion as ExpandControl and use textbox keyup event to expand extender on client side:
function expand() {
var extender = $find("CollapsibleExtender1");
if (extender.get_Collapsed()) {
$find("CollapsibleExtender1").expandPanel();
}
}
<asp:Panel runat="server" ID="CollapsiblePanel">
Cursus et amet cras egestas, turpis cras tempor diam scelerisque habitasse in, platea
augue turpis. Odio? Risus, ultricies! Dapibus risus sit. Placerat et in parturient
tristique, natoque porttitor, platea aenean, a, platea etiam urna, a cum nunc! Parturient
platea, sit mauris proin, magna lacus, eros, in sed nascetur tempor adipiscing.
</asp:Panel>
<asp:ImageButton runat="server" ID="MyImageButton" ImageUrl="~/Images/infoindicator.gif" />
<asp:Button runat="server" ID="MyButton" Text="Click Me" OnClientClick="expand(); return false;" />
<ajax:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" BehaviorID="CollapsibleExtender1"
ExpandControlID="MyImageButton" Collapsed="true" TargetControlID="CollapsiblePanel"
CollapsedText="Collapsed" ExpandedText="Expanded" SuppressPostBack="true" />