minglelinch
asked on
Click Event for telerik:RadMenuItem
I need to do something while clicking a telerik:RadMenuItem. It seems that there's no event like onclick for telerik:RadMenuItem. I used OnClientItemClicking in the following link:
http://www.telerik.com/help/aspnet-ajax/menu_clientsideonclientitemclicking.html
but I got OnClientItemClicking is not a valid attribute for element RadMenuItem.
How can I achieve it? Thanks.
http://www.telerik.com/help/aspnet-ajax/menu_clientsideonclientitemclicking.html
but I got OnClientItemClicking is not a valid attribute for element RadMenuItem.
How can I achieve it? Thanks.
"but I got OnClientItemClicking is not a valid attribute for element RadMenuItem" you can ignore this error. it's actaully just Visual Studio not recognising the telerik attributes. it wont affect your compiling, in fact, that problem should go away if you sometimes compile or reload the project.
you can also handle the menuclick events on the server side: http://www.telerik.com/help/aspnet-ajax/menu-server-side-item-click.html
for testing purposes.. you can also just add an alert to the onClicking javascript function... something like...
for testing purposes.. you can also just add an alert to the onClicking javascript function... something like...
function onClicking(sender, eventArgs)
{
alert('A menu item has been clicked');
Just as a quick test to satisfy yourself that things are working as they should.
I am also in for MlandaT's example.
ASKER
I tried ItemClick event and server function, and
protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
{
Telerik.Web.UI.RadMenuItem ItemClicked = e.Item;
}
The type or namespace 'RadMenuEventArgs' could not be found.
I tried OnClientItemClicking event with javascript function
function Logoff_ItemClick(sender, eventArgs)
{
alert('A menu item has been clicked');
}
The alert does not popup, nothing happens while clicking ... RadMenuItem is defined below -
<telerik:RadMenuItem Text="LOGOFF" OnClientItemClicking="Logo ff_ItemCli ck" ></telerik:RadMenuItem>
From http://www.telerik.com/help/aspnet-ajax/menu-client-side-events.html, OnClientItemClicking is set at RadMenu, not RadMenuItem. How can make click event on RadMenuItem ?
Thanks.
protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
{
Telerik.Web.UI.RadMenuItem
}
The type or namespace 'RadMenuEventArgs' could not be found.
I tried OnClientItemClicking event with javascript function
function Logoff_ItemClick(sender, eventArgs)
{
alert('A menu item has been clicked');
}
The alert does not popup, nothing happens while clicking ... RadMenuItem is defined below -
<telerik:RadMenuItem Text="LOGOFF" OnClientItemClicking="Logo
From http://www.telerik.com/help/aspnet-ajax/menu-client-side-events.html, OnClientItemClicking is set at RadMenu, not RadMenuItem. How can make click event on RadMenuItem ?
Thanks.
ASKER
I just set OnClientItemClicking="Logo ff_ItemCli ck" at RadMenu level, it works. The alert message popped up. Thanks for help.
ASKER
Still Not Right...
The alert message popup wheneve I clicked any menuitem. I only need to handle Logoff menuitem.
Please help ...
The alert message popup wheneve I clicked any menuitem. I only need to handle Logoff menuitem.
Please help ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can even add custom attributes and use them to modify the behaviour in the OnClientItemClicking handler http://www.telerik.com/help/aspnet-ajax/menu-items-custom-attributes.html
ASKER
Thanks for help. I made it work.
var item = eventArgs.get_item();
var txt = item.get_text();
if (txt == "LOGOFF") {
... ...
}
var item = eventArgs.get_item();
var txt = item.get_text();
if (txt == "LOGOFF") {
... ...
}