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

How to get invisible childitem from client side

1 Answer 31 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Fred Hsu
Top achievements
Rank 1
Fred Hsu asked on 01 Jun 2010, 05:35 PM
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.


1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Jun 2010, 08:14 AM
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.
Tags
Menu
Asked by
Fred Hsu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or