How to get invisible childitem from client side

2 posts, 0 answers
  1. Fred Hsu
    Fred Hsu avatar
    2 posts
    Member since:
    May 2010

    Posted 01 Jun 2010 Link to this post

    Hi, Expert,

    I create a RadMenuItem and set the item to invisible.
    On my client side code,

    I would like to set the radmenuitem to visible.

    {
      var menuItem2 = menu1.FindItemByText('Paste');
    .......



    }

    The FindItemByText can not get that item. (Only show visible item)

    I also try to use menu1.Items, the invisible is not there either.

    Can anyone have  idea how to get invisble item from menu on client side code?

    Thanks.


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Jun 2010 Link to this post

    Hello Fred,

    When setting the Visible property to "false", the item is not rendered on page, and you will not able to access it from client side.

    One suggestion to accomplish your requiremment is hiding items from client side itself, using the set_visible() property. Then you will able to set show the items by using set_visible() property.

    Hide the items in OnclientLoad event:
     
        function OnClientLoad(sender, args) {  
            var menu = sender;  
            var item = menu.findItemByValue('value1');  
            item.set_visible(false);  
        } 

    Now use the set_visible() property to show the item:
     
        function setVisible() {  
            var menu = $find("<%= RadMenu3.ClientID %>");  
            var item = menu.findItemByValue('value1');  
            item.set_visible(true);  
        } 


    Regards,
    Princy.
Back to Top