2
Hello.
I have the following scenario.
I want to use Ajaxcontroltoolkit’s Collapsiblepanelextender to make a collapsed panel.
However, the content that this panel will display will be dynamic and within a div.
My div already exists and within it there are several controls and I want to add this entire div inside the Asp:Panel that will be displayed by Collapsiblepanelextender.
If I could do this via codebehind I would just use the:
Painel.Controls.Add(div);
But I want to add this div to my panel via jquery or javascript.
How can I do that?
HTML (Collapse Mount Panels)
<asp:Panel ID="painelCollapsedCabecalho" runat="server" CssClass="cpHeader">
<asp:Label ID="lblCabacalho" runat="server" Text="Click here" />
</asp:Panel>
<asp:Panel ID="painelCollapsedCorpo" runat="server" CssClass="cpBody"/>
<cc1:CollapsiblePanelExtender ID="cpeCollapsed" runat="server" TargetControlID="painelCollapsedCorpo"
CollapseControlID="painelCollapsedCabecalho" ExpandControlID="painelCollapsedCabecalho"
Collapsed="true" TextLabelID="lblCabacalho" CollapsedText="Click to Show Search..."
ExpandedText="Click to Hide Search..." CollapsedSize="0" BehaviorID="collapsibleBehavior" />
Script (This is how I intended to add the div to my Asp:Panel, but it doesn’t work.)
<script type="text/javascript">
function pageLoad(sender, args) {
$("#painelCollapsedCorpo").append($("#divPesquisar"));
}
</script>
Can you set your HTML and explain better what jQuery? click from the user or via JS?
– Sergio
Sergio, I entered the requested code.
– Leonardo Ribeiro de Aguiar
This function occurs in the page Load.
– Leonardo Ribeiro de Aguiar
@Sergio a Function 'pageLoad(Sender, args)' is called by the . NET framework when loading the page. If I’m not talking nonsense it’s like the '$(Document). ready()' of jQuery or the 'onload' of javascript.
– Leonardo Ribeiro de Aguiar