Call a JavaScript Function from a menu item.

2 posts, 0 answers
  1. Edward
    Edward avatar
    10 posts
    Member since:
    Nov 2005

    Posted 22 Oct 2009 Link to this post

    I apologize if this has already been posted, however, I did not see an example that answered my question.

    I have a menu of eight custom buttons.  I would like only one of them to call a JavaScript function.  How do I accomplish this?  I was looking for a "onClick" for a single menu item but did not see anything.  Any direction would be helpful.  I have posted my code below:

    <SCRIPT type="text/javascript" LANGUAGE="JavaScript">  
    function executeCommands()  
    {  
    // Instantiate the Shell object and invoke its execute method.  
    var oShell = new ActiveXObject("Shell.Application");  
    var commandtoRun = "\\\\ms-180\\TimeClock Plus 5.0\\WINTCK32.EXE";  
    // Invoke the execute method.   
    oShell.ShellExecute(commandtoRun, "", "", "open", "1");  
    }  
    </SCRIPT> 
     
    <telerik:RadMenu ID="RDQuickLinks" runat="server" Skin="" Width="125px">  
                                                                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                                                                            <Items> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/attendancehover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/attendance.gif" NavigateUrl="https://itccs.esc13.net:3042/stmrpc" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for Attendance">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/studentgrade2hover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/studentgrade2.gif" NavigateUrl="http://fredericksburg.gradespeed.net/gs/Login.aspx?AuthType=Teacher" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for GradeSpeed">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/iTCCShover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/iTCCS.gif" NavigateUrl="https://itccs.esc13.net:3042/login" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for iTCCS">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/sishover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/sis.gif" NavigateUrl="http://intra1/StudentInfoSystem/default.aspx" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for Student Information System">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/techhelphover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/techhelp.gif" NavigateUrl="~/UserPages/InputTechHelpRequest.aspx" 
                                                                                    Width="60px" Height="60px"   
                                                                                    ToolTip="Click to submit a Technology Help Request">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/m1hover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/m1.gif" NavigateUrl="~/UserPages/InputMXWorkOrder.aspx" 
                                                                                    Width="60px" Height="60px"   
                                                                                    ToolTip="Click to submit a Maintenace Work Order">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/vodhover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/vod.gif" NavigateUrl="http://www.discoveryeducation.com/" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for Video on Demand">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" HoveredImageUrl="~/Images/LeftNavImages/BudgetHover.gif" 
                                                                                    ImageUrl="~/Images/LeftNavImages/Budget.gif" NavigateUrl="http://intra1/Budget/Default.aspx" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for Online Budget">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" 
                                                                                    ImageUrl="~/Images/LeftNavImages/Clock.gif" Value="Clock" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for Time Clock">  
                                                                                </telerik:RadMenuItem> 
                                                                                <telerik:RadMenuItem runat="server" 
                                                                                    ImageUrl="~/Images/LeftNavImages/Aware.gif" NavigateUrl="http://eduphoria.fisd.org" 
                                                                                    Width="60px" Height="60px" ToolTip="Click for Aware">  
                                                                                </telerik:RadMenuItem> 
                                                                            </Items> 
                                                                        </telerik:RadMenu> 
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 23 Oct 2009 Link to this post

    Hi Edward,

    You should subscribe to OnClientItemClicking event and cancel the server OnItemClick event depending on the clicked item.

    Greetings,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top