Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
821
Using Menu with ClientSide Events
posted

Hello Dear

I want to do some stuff in javascript when the user clicks an MenuItem;

As in the IG-Documentation, I use the following javascript function;

    function TopMenuClick(MenuId, ItemId) {

        if (itemId == "mnuID") {

        }
       
    }

In markup declared via;

<MenuClientSideEvents ItemClick="TopMenuClick()"/>

But ItemID and MenuID is always 'undefined' when the javascript function get hit, don't know why "MenuID" is undefined but for the Items I never set anything like a "ClientID" or a "ID" --> So I can understand that this is undefined in Javascript.

Can you tell me if Im doing something wrong, or where I can set the clientID and how to read it via javascript?

Thx

8.3.20083.2059

  • 4493
    Verified Answer
    posted

    Hello,

    You just need to remove the braces from clientside event declaration.

    Change ths line:

    <MenuClientSideEvents ItemClick="TopMenuClick()"/>

    into this:

    <MenuClientSideEvents ItemClick="TopMenuClick"/>
    (without braces).