Find Item by ID

2 posts, 0 answers
  1. Tab Alleman
    Tab Alleman avatar
    18 posts
    Member since:
    Apr 2010

    Posted 15 Jun 2010 Link to this post

    It seems to be the case that there is no way to find a menu item by its ID with server-side code.    Is this correct?   Please tell me I'm wrong.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Jun 2010 Link to this post


    As far as I know, there is no direct method for RadMenu to access the item using ID. RadMenu allows accessing items according to url, text, value there is GetAllItems method to access all the RadMenuItems, which is described in the documentation.

    But, you can explicitly check for the item by iterating through all the items as shown in the sample code.

        string value = "";              
        foreach (RadMenuItem item in RadMenu1.GetAllItems()) 
            if (item.Attributes["id"] == "id2")  // I set id attribute to each menuitem 
                value = item.Value; 
        RadMenuItem findItem = RadMenu1.FindItemByValue(value); 
        findItem.Text = "Got the item"

Back to Top