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

RadContextMenu control not working correctly in RadMenuItem

2 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
R2
Top achievements
Rank 1
R2 asked on 17 Dec 2008, 07:34 PM
Hello,

On page 52 (pg 40 in print PDF) "Context Menus", I'm doing the lesson on pages 53 - 55, however the context menu does not expand to show all the various options as shown on page 55. 

I copied and pasted the code in my project, but I kept getting a compilation error targeting "Imports Telerik.Web.UI (in red):
"Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)."  

Once I deleted the "Namespace Multipage" keyword structure.  I don't understand why I was getting a compilation error just by using the namespace. ??? 

Here is the code per the lesson (as well as in my project):

 

Protected Sub RadContextMenu1_ItemClick(ByVal sender As Object, ByVal e As  
Telerik.Web.UI.RadMenuEventArgs)  
' look only at child items  
If e.Item.Level = 1 Then  
' find child items under "Colors" parent item  
If (TryCast(e.Item.Parent, RadMenuItem)).Text.Equals("Colors") Then  
' set the color picker preset to the selected preset  
RadColorPicker1.Preset = DirectCast([Enum].Parse(GetType(ColorPreset), e.Item.Text),  
ColorPreset)  
End If  
End If  
End Sub  
End Class 

So my two questions would be:
1. Why is deleting the "Namespace" keyword eliminating the compilation error?  I thought creating and using Namespaces is a way to
"package" classes.  Thus, making them more unique.

2.  Why is the  RadContextMenu control working correctly in my application for the RadColorPicker control?  (All I see when I right-click is the word "Color".  No subitems as shown on page 43.

Thanks,
R2

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 20 Dec 2008, 01:55 PM
Hello R2,

The RadContextMenu tutorial which you have followed uses the previous project wit RadTabstrip as a starting point. You need to create the previous project to be able to use the Multipage namespace.

I have tested the tutorial in a simple website and everything worked well. Please, see the attached demo for reference.


Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
R2
Top achievements
Rank 1
answered on 23 Dec 2008, 04:36 PM
Thanks, Yana.  I will try what you suggest shortly.

Regards,
R2
Tags
General Discussions
Asked by
R2
Top achievements
Rank 1
Answers by
Peter
Telerik team
R2
Top achievements
Rank 1
Share this question
or