Menu Item On Click not firing

3 posts, 0 answers
  1. Aaron
    Aaron avatar
    1 posts
    Member since:
    Apr 2012

    Posted 12 Apr 2012 Link to this post

    I have a rad menu with several items.  The menu items lead to different places depending on a few things, so i'm trying to implement an OnClick handler in the code behind to redirect appropriately.  I've tried all kinds of combinations and scoured the forums and nothing has worked so far.  

       My OnClick method is just a stub right now with a breakpoint so I can see when it gets called, only it isn't getting called, and I'm redirected to the default.aspx page. 

    Ths is within a user control, if that matters.  Are you aware of anything that could cause this behavior? 

    protected void RadMenu_ItemClick(object sender, RadMenuEventArgs e)
                int i = 0;
                String s = e.Item.Value;

    <radM:RadMenu ID="RadMenu" runat="server"  OnItemClick="RadMenu_ItemClick" >
             <radM:RadMenuItem runat="server" ID="sampleItem" Text="Click Me" />
  2. Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010
  3. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 23 Apr 2012 Link to this post


    Re-iterate your UI:
    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="RadMenu2.aspx.cs" Inherits="Telerik.RadMenu.RadMenu2" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <telerik:RadMenu ID="RadMenu1" runat="server" onitemclick="RadMenu1_ItemClick" >
                <telerik:RadMenuItem  runat="server" ID="sampleItem1" Text="Home" />
                <telerik:RadMenuItem  runat="server" ID="sampleItem2" Text="Click Me" />

    Code behind:
    namespace Telerik.RadMenu
        public partial class RadMenu2 : System.Web.UI.Page
            protected void RadMenu1_ItemClick(object sender, Web.UI.RadMenuEventArgs e)
                int _i = 1;

    In Immediate window:
        base {Telerik.Web.UI.NavigationItem}: {Telerik.Web.UI.RadMenuItem}
        ClickedCssClass: "rmClicked"
        ClickedImageUrl: ""
        DataItem: null
        DisabledCssClass: "rmDisabled"
        DisabledImageUrl: ""
        EnableImageSprite: false
        ExpandedCssClass: "rmExpanded"
        ExpandedImageUrl: ""
        ExpandMode: ClientSide
        FocusedCssClass: "rmFocused"
        GroupSettings: {Auto,Vertical,0,0,,}
        HoveredImageUrl: ""
        ImageUrl: ""
        IsSeparator: false
        Items: {Telerik.Web.UI.RadMenuItemCollection}
        ItemTemplate: null
        Level: 0
        Menu: {Telerik.Web.UI.RadMenu}
        NavigateUrl: ""
        OuterCssClass: ""
        Owner: {Telerik.Web.UI.RadMenu}
        PostBack: true
        Selected: true
        SelectedCssClass: "rmSelected"
        SelectedImageUrl: ""
        Target: ""
        Text: "Click Me"
        Value: ""
    I think you are looking for Text not value, mine fired.
    You can do a case statement on Text, etc.
    switch( e.Item.Text.ToLower())
        case "home":
            int _i = 1;
        case "click me":
            int _j = 1;

Back to Top