This is a migrated thread and some comments may be shown as answers.

[Solved] Capture Which Panel is Expanded in Javascript

4 Answers 115 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Darren
Top achievements
Rank 1
Darren asked on 27 Dec 2011, 08:37 PM
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();
 }

4 Answers, 1 is accepted

Sort by
0
Kamen Bundev
Telerik team
answered on 28 Dec 2011, 11:01 AM
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
0
Darren
Top achievements
Rank 1
answered on 28 Dec 2011, 06:21 PM
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.
0
Accepted
Kamen Bundev
Telerik team
answered on 29 Dec 2011, 08:40 AM
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
0
Darren
Top achievements
Rank 1
answered on 29 Dec 2011, 07:25 PM
Got it! Thank you very much!
Tags
PanelBar
Asked by
Darren
Top achievements
Rank 1
Answers by
Kamen Bundev
Telerik team
Darren
Top achievements
Rank 1
Share this question
or