RadContextMenu control not working correctly in RadMenuItem

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 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.







  2. Peter
    Peter avatar
    6637 posts

    Posted 20 Dec 2008 Link to this post

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

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. R2
    R2 avatar
    63 posts
    Member since:
    Sep 2007

    Posted 23 Dec 2008 Link to this post

    Thanks, Yana.  I will try what you suggest shortly.

Back to Top