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

Set RadMenuItem visible

11 Answers 514 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Yesaya
Top achievements
Rank 1
Yesaya asked on 30 Dec 2010, 05:21 PM
Hi all,i wonder is it possible to set RadMenuItem to visible based on database value..Thanks

11 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 30 Dec 2010, 05:26 PM
Hello,

Yes, just get your database value as a boolean and set the visible property according to the value.
If you need further help, please let me know
thanks
Richard
0
Yesaya
Top achievements
Rank 1
answered on 30 Dec 2010, 05:31 PM
May i ask for an example how to achieve it?I'm trying to compare the string which was queried with the RadMenuItem Text.If it's the same then the menu will be shown.Thanks..
0
Richard Slade
Top achievements
Rank 2
answered on 30 Dec 2010, 05:33 PM
Which database are you using?
Richard
0
Yesaya
Top achievements
Rank 1
answered on 30 Dec 2010, 05:37 PM
I'm using microsoft access.
0
Richard Slade
Top achievements
Rank 2
answered on 30 Dec 2010, 06:00 PM
Hello,

Please have a look at this link which shows how to use ExecuteScaler in MS Access. You just need to return the boolean value from your database, based on the result of the ExecuteScaler. You may also find this MSDN Link on editing an Access Database useful.

hope that helps
Richard
0
Yesaya
Top achievements
Rank 1
answered on 30 Dec 2010, 07:00 PM
Could you give me an example how to set visibilty?Thanks..
0
Richard Slade
Top achievements
Rank 2
answered on 30 Dec 2010, 11:28 PM
Hello,

For the menu
Me.RadMenu1.Visible = False
or for an individual item
Me.RadMenuItem1.Visibility = ElementVisibility.Collapsed

hope that helps
Richard
0
Yesaya
Top achievements
Rank 1
answered on 31 Dec 2010, 02:36 AM
Thanks.by the way can i use trycast to cast the RadMenuItem visiblity?
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 31 Dec 2010, 10:00 AM
Hello,

For the RadMenuItem, you would need to do something like this..
Private Function GetVisibility() As ElementVisibility
    ' db code 
    Dim returnValueFromDatabase As Boolean = False
    If returnValueFromDatabase Then
        Return ElementVisibility.Visible
    Else
        Return ElementVisibility.Collapsed
    End If
End Function

Me.RadMenuItem1.Visibility = GetVisibility()

hope that helps
Please remember to mark as answer
Thanks
Richard
0
Rawad
Top achievements
Rank 2
answered on 10 Jul 2014, 12:26 PM
Hello Dear

Richard, your solution is working well, but how to resize the radcontextmenu,  lets say I have 4 items in the ContextMenu:
1-Item1
2-Item2
3-Item3
4-Item4

And I want to hide some radmenuitem, so I put the following code :
RadMenuItem2.Visibility = Telerik.WinControls.ElementVisibility.Hidden
RadMenuItem3.Visibility = Telerik.WinControls.ElementVisibility.Hidden

How to resize the radcontextmenu and to display   :
1-Item1
4-Item 4  

In my case I have 2 lines empty  between item1 & item 4  .
So how to make them Dock ?
  

0
Stefan
Telerik team
answered on 11 Jul 2014, 07:47 AM
Hello,

You can set the element's Visibility to Collapsed and the menu will be sized correctly.

I hope this helps.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Menu
Asked by
Yesaya
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Yesaya
Top achievements
Rank 1
Rawad
Top achievements
Rank 2
Stefan
Telerik team
Share this question
or