rad menu , check if item text exists

437 Views Asked by At

Using telerik and the radmenu, do you know how to check if the item exists by text

my menu contains the text "menu1"

If I use menu.FindItemByText("menu1").Enabled = False this will disable the button

BUT

If I use menu.FindItemByText("menuTEST").Enabled = False then I get an exception as this button does not exist.

How do I stop the error?

I tried this below but it say it cant return booloen

If menu.FindItemByText("menuTEST") then

'do this

End If
1

There are 1 best solutions below

0
On BEST ANSWER

Try this:

If Not(menu.FindItemByText("menuTEST") Is Nothing) then

    'do this

End If