RadMenu stretch menu items

3 posts, 0 answers
  1. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 03 Jan 2012 Link to this post

    Hello,

    I am trying to implement the solution found on the following page:

    http://www.telerik.com/support/kb/aspnet-ajax/menu/how-to-stretch-the-menu-items-to-fill-the-entire-width-of-the-menu.aspx

    However, I am having problems accessing the RadMenu control client side using the following line

    var menu = $find("<%= RadMenu1.ClientID %>");

    Please can someone let me know why I struggle to access Telerik controls using this type of javascript command?

    Also, does the code in the article above still in work in Q2 2011?

    Full code for my solution is below:

    <%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title></title>
    </head>
    <body onload="pageLoad()">
     
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
            EnableTheming="True">
        </telerik:RadScriptManager>
     
        <telerik:RadMenu ID="RadMenu1" runat="server">
        </telerik:RadMenu>
     
        </form>
     
    </body>
    <script type="text/javascript">
        function pageLoad() {
            var menu = $find("<%= RadMenu1.ClientID %>");
        }
    </script>
    </html>

    Thanks,

    Ken
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jan 2012 Link to this post

    Hello Ken,

    RadMenu creates a client-side object with the ClientID of the menu. Check the following help documentation which explains the same.
    Client-Side Basics

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ken Jones
    Ken Jones avatar
    41 posts
    Member since:
    Sep 2009

    Posted 03 Jan 2012 Link to this post

    Hello,

    Thanks for your response. I moved my code from onload of page to onload of the RadMenu itself and it works now.

    Ta,

    Ken
Back to Top