using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class swapPanelBar : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = rpbLHNav.Items[0].Items.Count; i > 0; i--)
        {
            RadPanelItem rpi = rpbLHNav.Items[0].Items[i - 1];
            if (rpi.Value != "newRootID")
            {
                rpbLHNav.Items[0].Items.Remove(rpi);
            }
        }
        RadPanelBar rpb2 = new RadPanelBar();
        for (int i = rpbLHNav.Items[0].Items.Count; i > 0; i--)
        {
            // adding the children of the item with ID newRootID
            rpb2.Items.Add(rpbLHNav.Items[0].Items[i - 1]);
        }
        PanelBarHolder.Controls.Clear();
        PanelBarHolder.Controls.Add(rpb2);
    }
}
