disable specific menu item on form load

2 posts, 0 answers
  1. JJ
    JJ avatar
    147 posts
    Member since:
    May 2010

    Posted 13 Jul 2010 Link to this post

    I load radmenu from sitemap, now i like to disable one manu item - "ADMIN" on form load.
    I tried the following code, but menuitem always returns null so it can never be disable.

    RadMenuItem menuitem = mainMenu.FindItemByValue("ADMIN");  
    if (menuitem != null)

     

    {

    menuitem.Enabled =

    false;  

     

     

      

    }
    What i did wrong?
    Thanks

     

     

     

     

     

     

     

  2. JJ
    JJ avatar
    147 posts
    Member since:
    May 2010

    Posted 13 Jul 2010 Link to this post

     

    private void DisableItemsFromText(string texttodisable)
    {
        var items = mainMenu.GetAllItems();
        int total_items = items.Count;
        for (int i = 0; i < total_items; i++)
        {
            if (items[i].Text.ToUpper()== texttodisable)
            {
                items[i].Enabled = false;
                items[i].NavigateUrl = "";
            }
        }
    }
    The above code works for me
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top