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

How to expand parent panel item ?

3 Answers 74 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
David Blok
Top achievements
Rank 1
David Blok asked on 29 Jun 2010, 08:05 AM
I've got a problem with selected the active node.

It works on the root nodes but not on child nodes, if a child node is selected the root node is not expanded.

 Protected Sub panelmenu1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles panelmenu1.ItemDataBound 
 
        Dim dataRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView) 
  
       If functions.FucGetPageID = dataRow("ID").ToString() Then 
 
            e.Item.Selected = True 
            e.Item.Expanded = True 
 
        End If 
 
    End Sub 

Also viewstate is disabled if it matters.

Frontside code:

<telerik:RadPanelBar runat="server" EnableViewState="false" CausesValidation="False" EnableEmbeddedSkins="False" ID="panelmenu1" Width="100%" OnPreRender="panelmenu1_PreRender" OnItemClick="RadPanelBar1_ItemClick" /> 


Anyone has an idea how to select the parent node and expand it ?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Jun 2010, 10:39 AM
Hello David,

The following code will help you in expanding the parent RadPanelItem of a particular item.

Code behind:
 
         e.Item.Selected = true 
        (e.Item.Parent as RadPanelItem).Expanded = true 
  


-Shinu.
0
David Blok
Top achievements
Rank 1
answered on 29 Jun 2010, 02:21 PM
Yes but im looking how to write it down

(e.Item.Parent as RadPanelItem).Expanded = true  

That doesn't work.
0
David Blok
Top achievements
Rank 1
answered on 30 Jun 2010, 12:21 PM
i found it ;)

this works
Dim parentnode As RadPanelItem = e.Item.Parent 
parentnode.Expanded = True 

Tags
PanelBar
Asked by
David Blok
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
David Blok
Top achievements
Rank 1
Share this question
or