This is a migrated thread and some comments may be shown as answers.

RadMenu stretch menu items

2 Answers 70 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ken Jones
Top achievements
Rank 1
Ken Jones asked on 03 Jan 2012, 10:27 AM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Jan 2012, 12:01 PM
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.
0
Ken Jones
Top achievements
Rank 1
answered on 03 Jan 2012, 02:28 PM
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
Tags
Menu
Asked by
Ken Jones
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ken Jones
Top achievements
Rank 1
Share this question
or