Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > PanelBar > Capture Which Panel is Expanded in Javascript

Answered Capture Which Panel is Expanded in Javascript

Feed from this thread
  • Darren avatar

    Posted on Dec 27, 2011 (permalink)

    I am having trouble figuring out which panel is expanded in the OnExpand client-side event.  I have a panel that allows multiple items to be expanded, and I need to figure out which item is expanded/collapsed.  My code for the panel is below.  Any help would be greatly appreciated.

    Thanks,

    -Darren

    @{Html.Telerik().PanelBar()
        .Name("pnlUserForm")
        .ClientEvents(e => e.OnExpand("pnlUserForm_OnExpand").OnCollapse("pnlUserForm_OnCollapse"))
        .Items(i =>
        {
            i.Add()
                .Text("User Information")
                .Expanded(true)
                .Content(
                    @<text>
                        <span id="validationErrors" class="errorMessage noDisplay"></span>
                                                    ...

                     </text>);
            i.Add()
                .Text("Contact Information")
                .Content("This is the Contact Panel");
     
            i.Add()
                .Text("Positional Responsibilities")
                .Content("Positional Responsibilities");
     
            
                i.Add()
                    .Text("Account / Password Management")
                    .Content(
                    @<text>
                        <div class="container" style="height: 200px;">
                            ...
                        </div>
                    </text>);
     
            }
     
            i.Add()
                .Text("View Permissions")
                .Content("Permissions Panel");
        })
        .Render();
     }

    Reply

  • Kamen Bundev Kamen Bundev avatar

    Posted on Dec 28, 2011 (permalink)

    Hi Darren,

    All expanded panels have the .t-state-active CSS class applied on the item (LI element), you can use this class to find them.

    Regards,
    Kamen Bundev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

  • Darren avatar

    Posted on Dec 28, 2011 (permalink)

    Thanks, Kamen. However, I am allowing multiple panels to be open at once. So, what I really need to know is which panel was clicked/expanded.

    Reply

  • Answer Kamen Bundev Kamen Bundev avatar

    Posted on Dec 29, 2011 (permalink)

    Hi Darren,

    The OnExpand/OnCollapse events return an argument with item property that holds the currently expanding/collapsing item element.

    Kind regards,
    Kamen Bundev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

  • Darren avatar

    Posted on Dec 29, 2011 (permalink)

    Got it! Thank you very much!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > PanelBar > Capture Which Panel is Expanded in Javascript
Related resources for "Capture Which Panel is Expanded in Javascript"

ASP.NET MVC PanelBar Features  |  Documentation  |  Demos  |  Telerik TV ]