How to determine if Event is being attached

3 posts, 1 answers
  1. Robert Bross
    Robert Bross avatar
    27 posts
    Member since:
    Oct 2012

    Posted 02 Jul 2008 Link to this post

    Is there anyway to check on the client side whether an event is attatched to a menu item? I am setting the OnClientItemClicked event of the menu and it is not firing when I click a menu item. I'm setting the event in my code behind page on the server side like this...

    mainMenu.OnClientItemClicked = "hideMainMenu";

    Basically what I want to do is have a "Menu" button that will show the menu and then after they select any of the menu items, I want to hide the meu again. Very similar to how a context menu with the exception that this will be the main menu. It is up to the client though, if they want to always show the menu or only show it when the click the menu button which is why I am setting the OnClientItemClicked event in code vs on the page.

    Thanks!

    ===== Menu Code in ASPX page =============

    <telerik:RadMenu ID="mainMenu" runat="server"
                    EnableViewState="False" Flow="Vertical" Skin="Vista">
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                </telerik:RadMenu>
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jul 2008 Link to this post

    Hi Robert,

    I tried this on my end and it is working  as expected. Try the following code snippet.

    ASPX:
    <script language="javascript"  type="text/javascript" > 
      
     function hideMainMenu() 
     { 
      alert('Clicked'); 
     } 
    </script> 


    CS:
    protected void Page_Load(object sender, EventArgs e) 
        { 
            mainMenu.OnClientItemClicked = "hideMainMenu"
        } 


    Thanks
    Shinu.
  3. Robert Bross
    Robert Bross avatar
    27 posts
    Member since:
    Oct 2012

    Posted 03 Jul 2008 Link to this post

    Thanks Shinu! I found that it was a scripting error on my end that was preventing the javascript file from being processed at all. Sorry to have wasted your time with this.
Back to Top