martedì 19 febbraio 2013

Expand/Collapse JQuery Accordion at Runtime by C#

The following code shows a simple way to Collapse/Expand JQuery Accordion by C#

JQuery Code to make accordion:

$(function ()
        {
            $("#yourDivID").accordion(
            {
                heightStyle: "content",
                collapsible: true
            });
        });


Html code to make the accordion:

<div id="yourDivID ">
<h3>Your DIV Title</h3>
<div>

</div>
</div>


C# code to Collapse/Expand JQuery Accordion:

if (true….)
script = "$(\"#yourDivID\").accordion('activate', 'false'); ";
else
script = "$(\"#yourDivID\").accordion('option', 'active', 0); ";
           
ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), script, true);



My Two Cents ...

Nessun commento:

Posta un commento