Hide or Show Items in the PanelBar

0 Answers 161 Views
PanelBar
Angela
Top achievements
Rank 1
Iron
Angela asked on 18 Aug 2022, 03:37 PM
I have a PanelBar that is tied to a sql server stored procedure. In my stored procedure, I am working out the users who should see certain panel items, so I have a field called "Item_Visible". Is there a way to get each item to pull from what I am returning in my stored procedure are mark the items visibility based on that field? 
Angela
Top achievements
Rank 1
Iron
commented on 18 Aug 2022, 03:52 PM

I should have kept looking. I think I have figured it out:

    Protected Sub RadPanelBar_ItemDataBound(sender As Object, e As RadPanelBarEventArgs)
        Dim row As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
        e.Item.Visible = DataBinder.Eval(e.Item.DataItem, "Item_Visible")
    End Sub


Rumen
Telerik team
commented on 19 Aug 2022, 08:10 AM

Thank you for sharing your nice solution, Angela! 

For fellow developers, it might be useful to share another approach for hiding the panelbar items with a CSS style demonstrated in this forum thread: Hide element of RadPanelItem

No answers yet. Maybe you can help?

Tags
PanelBar
Asked by
Angela
Top achievements
Rank 1
Iron
Share this question
or