Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Click Event for telerik:RadMenuItem

Posted on 2011-04-19
9
Medium Priority
?
2,981 Views
Last Modified: 2012-05-11
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.
0
Comment
Question by:minglelinch
  • 4
  • 4
9 Comments
 
LVL 31

Expert Comment

by:MlandaT
ID: 35428772
"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.
0
 
LVL 31

Expert Comment

by:MlandaT
ID: 35428781
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...
function onClicking(sender, eventArgs)
{
    alert('A menu item has been clicked');

Open in new window

Just as a quick test to satisfy yourself that things are working as they should.
0
 
LVL 8

Expert Comment

by:databoks
ID: 35429272
I am also in for MlandaT's example.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:minglelinch
ID: 35433945
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="Logoff_ItemClick" ></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.    
0
 
LVL 1

Author Comment

by:minglelinch
ID: 35434040
I just set OnClientItemClicking="Logoff_ItemClick" at RadMenu level, it works. The alert message popped up. Thanks for help.
0
 
LVL 1

Author Comment

by:minglelinch
ID: 35434287
Still Not Right...

 The alert message popup wheneve I clicked any menuitem. I only need to handle Logoff menuitem.
Please help ...
0
 
LVL 31

Accepted Solution

by:
MlandaT earned 2000 total points
ID: 35434414
but using their example... they show how you can get additional info about the menu item that has been clicked. you can do various things based on the navigateUrl for example.
    function onClicking(sender, eventArgs) {
        var item = eventArgs.get_item();
        var navigateUrl = item.get_navigateUrl();
 if (navigateUrl && navigateUrl != "#" || navigateUrl != "Logout.aspx") {
            var proceed = confirm("Navigate to " + navigateUrl + " ?");     
            if (!proceed)     
            {       
                eventArgs.set_cancel(true);     
            }   
        } 

Open in new window

0
 
LVL 31

Expert Comment

by:MlandaT
ID: 35434433
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
0
 
LVL 1

Author Comment

by:minglelinch
ID: 35435797
Thanks for help. I made it work.

            var item = eventArgs.get_item();
            var txt = item.get_text();
            if (txt == "LOGOFF") {
                     ... ...
            }
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question