How to expand parent panel item ?

4 posts, 0 answers
  1. David Blok
    David Blok avatar
    42 posts
    Member since:
    Nov 2009

    Posted 29 Jun 2010 Link to this post

    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 ?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Jun 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David Blok
    David Blok avatar
    42 posts
    Member since:
    Nov 2009

    Posted 29 Jun 2010 Link to this post

    Yes but im looking how to write it down

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

    That doesn't work.
  5. David Blok
    David Blok avatar
    42 posts
    Member since:
    Nov 2009

    Posted 30 Jun 2010 Link to this post

    i found it ;)

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

Back to Top