Ordering MenuItems

2 posts, 0 answers
  1. Craig
    Craig avatar
    3 posts
    Member since:
    Mar 2008

    Posted 21 Mar 2008 Link to this post

    Hi all,

    I was wondering if it is possible to order the menu items. I am creating a MenuItem dynamicaly in code behind on page load and then once I have this Item I then need to load in the rest of the menu using the LoadContentFile method of the control.

    The problem is that my menu adds the first item to the end after the LoadContentFile and I need it to be the first item in the menu. So it looks like this:

    Item2 Item3 Item4 Item1

    Is it possible to have it so that I have my dynamicaly created MenuItem be the first in the list? I had this working in the old menu with the same code but Prometheus doesnt seem to like it?

    Any ideas??

    Much appreciated.

    Craig
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 21 Mar 2008 Link to this post

    Hi Craig,

    Please, try inserting the item in the DataBound event. That's when all items are already created and their position in the menu item array is stable.

    protected void RadMenu1_DataBound(object sender, EventArgs e)  
        {  
            RadMenuItem firstItem = new RadMenuItem("first item");  
            RadMenu1.Items.Insert(0, firstItem);  
        } 


    Best wishes,
    Peter
    the Telerik team

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