Expandable arrow on left hand side

5 posts, 1 answers
  1. Brad H
    Brad H avatar
    31 posts
    Member since:
    Aug 2009

    Posted 11 Jan 2010 Link to this post

    Is it possible to get the expandable arrows to appear on the left side of the text in my panelbar items?  I have been trying to figure this out to no avail.  Any help would be greatly appreciated.  Thank you.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2010 Link to this post

    Hello Brad,

    You can use the following code to dispplayimages on the left side of the panelbaritems
    c#:
    protected void RadPanelBar1_PreRender(object sender, EventArgs e) 
        { 
            foreach (RadPanelItem item in RadPanelBar1.Items) 
            { 
                if (item.Items.Count > 0) 
                { 
                    item.ImageUrl = "~/Images/Image1.gif"
                    item.ExpandedImageUrl = "~/Images/Image2.gif"
     
                    foreach (RadPanelItem subItem in item.Items) 
                    { 
                        if (subItem.Items.Count > 0) 
                        { 
                            subItem.ImageUrl = "~/Images/Image1.gif"
                            subItem.ExpandedImageUrl = "~/Images/Image2.gif"
                        } 
                    } 
                } 
            }         
        } 

    And to hide the arrows on the right hand side, try the following css setting:
    css:
    .RadPanelBar_Default .rpExpandable .rpText, .RadPanelBar_Default .rpExpanded .rpText 
        { 
            background-imagenone !important;    
        }  

    Hope this helps..
    -Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brad H
    Brad H avatar
    31 posts
    Member since:
    Aug 2009

    Posted 12 Jan 2010 Link to this post

    Thank you.  This has helped tremendously!  Here is the VB code in case anyone needs it:

    Protected Sub PanelBarLeft_PreRender(ByVal sender As ObjectByVal e As EventArgs) 
            For Each item As Telerik.Web.UI.RadPanelItem In PanelBarLeft.Items 
                If item.Items.Count > 0 Then 
                    item.ImageUrl = "~/global/images/sidenav_closed_arrow.png" 
                    item.ExpandedImageUrl = "~/global/images/sidenav_open_arrow.png" 
                    For Each subItem As Telerik.Web.UI.RadPanelItem In item.Items 
                        If subItem.Items.Count > 0 Then 
                            subItem.ImageUrl = "~/global/images/sidenav_closed_arrow.png" 
                            subItem.ExpandedImageUrl = "~/global/images/sidenav_open_arrow.png" 
                        End If 
                    Next 
                End If 
            Next 
        End Sub 

    Thanks again!
  5. Jose Antonio Gonzalez
    Jose Antonio Gonzalez avatar
    4 posts
    Member since:
    Sep 2009

    Posted 12 Jan 2010 Link to this post

    Here is a recursive way to do the same for all levels, not only the first 2 levels...

            protected void _radPanelBar1_PreRender(object sender, EventArgs e) 
            { 
                foreach (RadPanelItem item in _radPanelBar1.Items) 
                { 
                    SetArrows(item); 
                } 
            } 
     
            protected void SetArrows(RadPanelItem Item) 
            { 
                if (Item.Items.Count > 0) 
                { 
                    Item.ImageUrl = "~/Images/Arrow1.gif"
                    Item.ExpandedImageUrl = "~/Images/Arrow2.gif"
                    foreach (RadPanelItem _item in Item.Items) 
                    { 
                        SetArrows(_item); 
                    } 
                } 
            } 

  6. Srinivas
    Srinivas avatar
    1 posts
    Member since:
    Jul 2010

    Posted 14 Mar 2011 Link to this post

    Awsome friends ! This is what I was looking for.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017