using System;
using System.Data;
using System.Configuration;
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;

public partial class _Default : System.Web.UI.Page
{
  private DataTable CreateTable()
  {
    DataTable tbl = new DataTable();
    tbl.Columns.Add( "ID" );
    tbl.Columns.Add( "Text" );
    tbl.Columns.Add( "Value" );
    tbl.Columns.Add( "ParentID" );

    tbl.Rows.Add( "1", "Products", "You clicked Products", null );
    tbl.Rows.Add( "2", "Support", "You clicked Support", null );
    tbl.Rows.Add( "3", "r.a.d.editor", "You clicked r.a.d.editor", 1 );
    tbl.Rows.Add( "4", "r.a.d.panelbar", "You clicked r.a.d.panelbar", 1 );
    tbl.Rows.Add( "5", "r.a.d.menu", "You clicked r.a.d.menu", 1 );
    tbl.Rows.Add( "6", "r.a.d.tabstrip", "You clicked r.a.d.tabstrip", 1 );
    tbl.Rows.Add( "7", "Knowledge Base", "You clicked Knowledge Base", 2 );
    tbl.Rows.Add( "8", "Forums", "You clicked Forums", 2 );
    tbl.Rows.Add( "9", "Articles", "You clicked Articles", 2 );
    tbl.Rows.Add( "10", "FAQ", "You clicked FAQ", 2 );
    return tbl;
  }


  protected void Page_Load( object sender, EventArgs e )
  {
    RadPanelbar1.DataSource = CreateTable();
    RadPanelbar1.DataFieldID = "ID";
    RadPanelbar1.DataTextField = "Text";
    RadPanelbar1.DataValueField = "Value";
    RadPanelbar1.DataFieldParentID = "ParentID";
    RadPanelbar1.DataBind();
    RadPanelbar1.PersistStateInCookie = true; // this can also be set in the Properties Window
  }
  protected void RadPanelbar1_ItemClick( object sender,
    Telerik.WebControls.RadPanelbarEventArgs e )
  {
    Label1.Text = e.Item.Value;
  }
  protected void RadPanelbar1_ItemCreated( object sender,
    Telerik.WebControls.RadPanelbarEventArgs e )
  {
    Label2.Text += e.Item.Text + " has been added" + "<br/>";
  }
  protected void RadPanelbar1_ItemDataBound( object sender, Telerik.WebControls.RadPanelbarEventArgs e )
  {
    DataRowView row = (DataRowView)e.Item.DataItem;
    e.Item.Text = row["Text"].ToString() + " from IDB";
  }
}

