Hi all,
I have a RadMenu1 control, with inside 10 controls (named RadMenuItem1,RadMenuItem2,RadMenuItem3,...)
How can I change the visibility of the RadMenuItem elements in a loop ?
I try to use :
for i=1 to 10 me.controls("RadMenuItem" & i.tostring).visible=False or True but it don't work !
Thanks
I have a RadMenu1 control, with inside 10 controls (named RadMenuItem1,RadMenuItem2,RadMenuItem3,...)
How can I change the visibility of the RadMenuItem elements in a loop ?
I try to use :
for i=1 to 10 me.controls("RadMenuItem" & i.tostring).visible=False or True but it don't work !
Thanks
4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 21 Jan 2013, 06:16 AM
Hi,
Try the following code snippet to achieve your scenario.
VB:
Hope this helps.
Regards,
Princy.
Try the following code snippet to achieve your scenario.
VB:
For
i
As
Integer
= 0
To
9
RadMenu1.Items(i).Visibility = ElementVisibility.Hidden
'or
RadMenu1.Items(i).Visibility = ElementVisibility.Visible
Next
Hope this helps.
Regards,
Princy.
0
Hello,
Thank you for writing.
To hide an item, you should set the items' Visibility property to Hidden or Collapsed.
I hope this helps.
Regards,
Stefan
the Telerik team
Thank you for writing.
To hide an item, you should set the items' Visibility property to Hidden or Collapsed.
I hope this helps.
Regards,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Ali
Top achievements
Rank 1
answered on 21 Jan 2013, 12:20 PM
Hi Princy,
By this code i can change visibility of main menu. How to do that for sub menu.
Thank you.
By this code i can change visibility of main menu. How to do that for sub menu.
Thank you.
0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Jan 2013, 05:52 AM
Hi,
Try the following code snippet to change the visibility of sub RadMenuItems.
C#:
Hope this helps.
Regards,
Princy.
Try the following code snippet to change the visibility of sub RadMenuItems.
C#:
for
(
int
i = 0; i < 2; i++)
{
RadMenuItem item=(RadMenuItem)RadMenu1.Items[i];
if
(item.Items.Count > 0)
{
for
(
int
j = 0; j < item.Items.Count; j++)
{
item.Items[j].Visibility = ElementVisibility.Hidden;
}
}
}
Hope this helps.
Regards,
Princy.