+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Client Side Woes

Client Side Woes

4 posts, 0 answered
  1. Steven
    Steven avatar
    15 posts
    Registered:
    05 Jun 2008
    29 Jul 2008
    Link to this post

    Hello, I seem to be having some Client-Side reference issues. I am trying to figure out how to hook into RadMenu client side events.

    I have tried following the Client-Side Programming documentation. I have also attempted to find some Client-Side solutions in the Telerik RadMenu forums.

    Listed below is the latest example that I have tried to follow (from this posting: http://www.telerik.com/community/code-library/submission/b311D-egktk.aspx ).

    Why does this not work? I get the following Javascript error returned:

    null is null or is not an object

    Also, the version of the RadMenu.Net2.dll is: 4.4.5.0

    <%@ Master Language="VB" %> 
    <%@ Register Assembly="RadMenu.Net2" Namespace="Telerik.WebControls" TagPrefix="radM"%> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <script runat="server">  
         
    </script> 
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head id="Head1" runat="server">  
        <title>Untitled Page</title> 
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />     
       <script type="text/javascript">     
        function pageLoad()     
        {     
            var menu = $find("<%# RadMenu1.ClientID %>");     
            var href = window.location.href;     
            var index = href.lastIndexOf("/");     
            var pageURL = href.substring(index + 1);     
                 
            var items = menu.get_items();     
            var item = null;     
                 
            for (var i = 0; i < items.get_count(); i++)     
            {     
                if (items.getItem(i).get_navigateUrl() == pageURL)     
                {     
                    item = items.getItem(i);     
                    break;     
                }         
            }            
                 
            if (item)     
            {     
                while (item != menu)     
                {     
                    var element = item.get_linkElement();     
                    element.className += " rmFocused";     
                    itemitem = item.get_parent();     
                }     
            }          
        }     
    </script>    
    </head> 
    <body onload="pageLoad()">  
        <form id="form1" runat="server">  
            <asp:ScriptManager ID="ScriptManager1" runat="server">  
            </asp:ScriptManager> 
            <asp:SiteMapDataSource ID="SitemapDataSource1" runat="server" ShowStartingNode="false" /> 
            <div id="wrapper">  
            <div id="Header">  
                <h1>My Organization</h1> 
                <div id="TopNavigation">  
     
                <radM:RadMenu ID="RadMenu1" runat="server" DataSourceID="SitemapDataSource1" Skin="Outlook">  
                </radM:RadMenu> 
              
                </div> 
            </div> 
            <div id="Main"><asp:contentplaceholder id="Content" runat="server"></asp:contentplaceholder></div>  
            <div id="SideBar">  
              
            <br /> 
            <asp:contentplaceholder id="SideBarContent" runat="server"></asp:contentplaceholder></div>      
            <div id="Footer">2006-2007 &copy; MyOrganization. All rights reserved </div> 
           </div> 
       </form> 
    </body> 
    </html> 
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    30 Jul 2008
    Link to this post
    Hi Steven,

    Please, note that the javascript code provided in the following article refers to RadMenu for ASP.NET AJAX and to the classic RadMenu. RadControls for ASP.NET AJAX have a different client-side API and that is the reason why the example does not work in your case.

    You can either modify the javascript function (here is a reference to the client-side API of the classic RadMenu) or use the new version of RadMenu available as a part of RadControls for ASP.NET AJAX suite. We strongly recommend using the new version for all new implementations.

    Do let us know if you need any further assistance.

    Kind regards,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Steven
    Steven avatar
    15 posts
    Registered:
    05 Jun 2008
    11 Aug 2008
    Link to this post

    I believe that I do need further assistance. I am working with the Rad ASP.Net AJAX Controls that were shipped as part of Sitefinity 3.2 SP2 with the Sitefinity_3_2_1616_standard_patch applied.

    I am desperately trying to get some Client Side interaction with the Rad Menu control to work. However, I am having trouble getting a simple reference to the RadMenu control on the client side to work.

    I have recently discovered that with MasterPages (Templates), ASP.Net will alter the ClientID to ensure that they are unique. I thought this might be the cause for the trouble that I have been expierencing.

    With this in mind, I have attempted to get a Client Side reference to the Rad Menu to work in a standard WebForm (instead of a UserControl or MasterPage) in the root of my Sitefinity project.

    Unfortunately, I continue to receive the following JavaScript error when I try to interact with the Rad Menu: Object expected

    The code I'm working with in this WebForm is listed below. I don't understand, what am I doing wrong here?

    Thanks,

    Steven

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="rmScript.aspx.vb" Inherits="rmScript" %> 
    <%@ Register Assembly="RadMenu.Net2" Namespace="Telerik.WebControls" TagPrefix="radM"%> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <title>Untitled Page</title> 
    </head> 
    <body> 
    <script language="javascript" type="text/javascript">  
          
            function onClicking(sender, eventArgs)  
            {  
              var menu = $find("<%= RadMenu1.ClientID %>");                   
              //alert(menu.ID);            
            }  
              
    </script> 
        <form id="form1" runat="server">  
        <div><radM:RadMenu ID="RadMenu1" runat="server" Skin="Vista" OnClientItemClicking="onClicking"></radM:RadMenu></div>  
        </form> 
    </body> 
    </html> 

    Imports Telerik.WebControls.RadMenu  
    Partial Class rmScript  
        Inherits System.Web.UI.Page  
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
     
            RadMenu1.LoadContentFile("raMenuTest.xml")  
     
        End Sub  
    End Class 

  4. Atanas Korchev
    Atanas Korchev avatar
    1 posts
    Registered:
    30 Nov 2015
    12 Aug 2008
    Link to this post
    Hi Steven,

    You seem to be using RadMenu classic with the API of RadMenu for ASP.NET Ajax. Please check this online example how to consume RadMenu classic events as well as this help topic.

    Sincerely yours,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered