RadMenuGroup

2 posts, 0 answers
  1. ghadeer
    ghadeer avatar
    57 posts
    Member since:
    Mar 2008

    Posted 28 May 2008 Link to this post

    Hi All,
    am just start building a website and I will use radmenu ,so I will try to get it  but I get error on Menugroup name space.

    could any one help me ?????????


    my code:

    protected void Page_Load(object sender, EventArgs e)

    {

    GenerateMenu();

    }

    private void GenerateMenu()

    {

    string _ConnectionString = "PROVIDER=MSDAORA;USER ID=HSAJAD;PASSWORD=SAJJAD;DATA SOURCE=HCARE.WORLD";

    OleDbConnection OldDbCon = new OleDbConnection(_ConnectionString);

    OldDbCon.Open();

    OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT id,parentId,e_text,E_URL FROM INTERNET_MENU ", OldDbCon);

    DataSet ds = new DataSet();

    adapter.Fill(ds);

    ds.Relations.Add(

    "NodeRelation", ds.Tables[0].Columns["id"], ds.Tables[0].Columns["parentId"], false);

    MenuGroup MainGroup =

    new MenuGroup();

    MainGroup.Flow = PresentationDirection.Horizontal;

    RadMenu1.RootGroup = MainGroup;

    foreach (DataRow dbRow in ds.Tables[0].Rows)

    {

    if (dbRow.IsNull("parentId"))

    {

    Telerik.WebControls.

    RadMenuItem item = new Telerik.WebControls.RadMenuItem();

    item.Text = dbRow[

    "Text"].ToString();

    MainGroup.AddItem(item);

    RecursivelyPopulate(dbRow, item);

    }

    }

    OldDbCon.Close();

    }

     

     

    private void RecursivelyPopulate(DataRow dbRow,Telerik.WebControls.RadMenuItem item)

    {

    MenuGroup CurrentGroup =

    new MenuGroup();

    foreach (DataRow childRow in dbRow.GetChildRows("NodeRelation"))

    {

    Telerik.WebControls.

    RadMenuItem childItem = new Telerik.WebControls.RadMenuItem();

    childItem.Text = childRow[

    "Text"].ToString();

    CurrentGroup.AddItem(childItem);

    RecursivelyPopulate(childRow, childItem);

    }

    if (CurrentGroup.Items.Count > 0)

    {

    item.ChildGroup = CurrentGroup;

    }

    }






    please help me as soon as possible
    thanks in advance
    ghadeer
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 24 Jun 2008 Link to this post

    Hi ghadeer,

    Please answer our questions in Ticket ID-145953.

    Sincerely yours,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top