Selected Item Data Binding

1 Answer 257 Views
PanelBar
Andrew
Top achievements
Rank 1
Iron
Iron
Andrew asked on 13 Nov 2023, 08:58 PM

Hello,

My use case requires me to be able to set the selected panel bar item programmatically. However, I don't see any data bindings or api methods on the control ref to set the selected panel. Is this possible?

Setting the private member SelectedItem through reflection appears to work. Are there implications to doing this that I should be aware of?

        PanelBarRef.GetType().InvokeMember("SelectedItem",
            BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.SetProperty | BindingFlags.Instance, 
            null, 
            PanelBarRef,
            new object[] { SelectedPage });

 

Thank You,

-Andy

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Nov 2023, 11:49 AM

Hi Andy,

This approach is not officially documented and supported, so we haven't tested it and cannot claim that it's reliable.

Alternatively, you can use OnItemRender and some custom CSS:

Select PanelBar item programmatically

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Joel
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 25 Jul 2025, 11:58 PM

This is an inadequate solution and its now been 2 years.  You need to treat this like the TelerikGrid and have a SelectedItems collection.
Dimo
Telerik team
commented on 28 Jul 2025, 05:58 AM

@Joel - indeed, we have a feature request for built-in API for setting and getting the selected PanelBar items. I voted on your behalf.
Tags
PanelBar
Asked by
Andrew
Top achievements
Rank 1
Iron
Iron
Answers by
Dimo
Telerik team
Share this question
or