Revised: RadContextMenu not showing all options

3 posts, 0 answers
  1. R2
    R2 avatar
    63 posts
    Member since:
    Sep 2007

    Posted 17 Dec 2008 Link to this post


    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  
    ' 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),  
    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.


  2. R2
    R2 avatar
    63 posts
    Member since:
    Sep 2007

    Posted 18 Dec 2008 Link to this post


    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.
  3. DevCraft R3 2016 release webinar banner
  4. Yana
    Yana avatar
    4548 posts

    Posted 22 Dec 2008 Link to this post

    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,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top