This is a migrated thread and some comments may be shown as answers.

Ordering MenuItems

1 Answer 16 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 21 Mar 2008, 01:47 PM
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

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 Mar 2008, 05:41 PM
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
Tags
Menu
Asked by
Craig
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or