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", "News", null, null );
    tbl.Rows.Add( "2", "Sports", null, null );
    tbl.Rows.Add( "3", "Events", null, null );

    tbl.Rows.Add( "4", "CNN", "http://www.cnn.com", 1 );
    tbl.Rows.Add( "5", "NBC", "http://www.nbc.com", 1 );
    tbl.Rows.Add( "6", "Fox", "http://www.fox.com", 1 );

    tbl.Rows.Add( "7", "ESPN", "http://www.espn.com", 2 );
    tbl.Rows.Add( "8", "USA Hockey", "http://www.usahockey.com", 2 );

    tbl.Rows.Add( "9", "Oscar Awards", "http://www.oscars.com", 3 );
    tbl.Rows.Add( "10", "MTV Movie Awards", "http://www.mtv.com", 3 );

    return tbl;
  }

  protected void Page_Load( object sender, EventArgs e )
  {
    RadMenu1.DataSource = CreateTable();
    RadMenu1.DataFieldID = "ID";
    RadMenu1.DataTextField = "Text";
    RadMenu1.DataValueField = "Value";
    RadMenu1.DataFieldParentID = "ParentID";
    RadMenu1.DataBind();

  }
  protected void RadMenu1_ItemClick( object sender, 
    Telerik.WebControls.RadMenuEventArgs e )
  {
    if(e.Item.Value != null)
    {
      string url = e.Item.Value;
      Response.Redirect( url ); 
    }
  }

  protected void RadMenu1_ItemDataBound( object sender, 
    Telerik.WebControls.RadMenuEventArgs e )
  {
    DataRowView row = (DataRowView)e.Item.DataItem;
    if( row["Value"] is System.DBNull )
      e.Item.PostBack = false; 

  }
}

