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

Revised: RadContextMenu not showing all options

2 Answers 33 Views
Menu
This is a migrated thread and some comments may be shown as answers.
R2
Top achievements
Rank 1
R2 asked on 17 Dec 2008, 09:37 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 isn't (correction) 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
R2
Top achievements
Rank 1
answered on 18 Dec 2008, 02:42 PM
Hello,

Can anyone from Telerik offer an answer here, or at least an acknowledgement that my question/s were reviewed?  If I am missing something here in the lesson, please point that out as I'm trying to learn the tool.  The RadContextMenu should work as outlined in the walkthrough, but it does not.
0
Yana
Telerik team
answered on 22 Dec 2008, 08:23 AM
Hello there,

Straight to your questions:

   1. When you're using a namespace in your code-behind like this:

namespace MyStuff  
{  
    public class MyClass : Page  
    {  
    }  
 
then in the aspx file you should inherit also the namespace:

<%@ Language="C#" Inherits="MyStuff.MyClass" %> 

I suppose that this causes the first error in your project.

   2. I've prepared a sample project based on the tutorial and it works without a problem. Please download the attached file and give it a try.

Best wishes,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Menu
Asked by
R2
Top achievements
Rank 1
Answers by
R2
Top achievements
Rank 1
Yana
Telerik team
Share this question
or