Normally, a group of child items expands adjacent to its parent item. You may want to change this setting for a particular group of items, so that the child items expand somewhere else on the page.
To allow this, the RadMenuItem.GroupSettings class exposes the OffsetX and OffsetY properties. They indicate the horizontal and vertical offset of child menu items. The offset is measured in pixels. The value is relative to the parent item: the default value in both axes is 0 (no offset).
<%@ Page Language="vb" CodeFile="DefaultVB.aspx.vb" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Menu.OffsetingTheGroups.DefaultVB" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %><%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %><%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %><%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <qsf:HeadTag ID="Headtag1" runat="server" /> <link rel="stylesheet" type="text/css" href="styles.css" /></head><body class="BODY"> <form id="mainForm" method="post" runat="server"> <telerik:RadScriptManager ID="ScriptManager" runat="server" /> <qsf:Header ID="Header1" runat="server" NavigationLanguage="VB" ShowSkinChooser="false" /> <div id="qsfexWrapper"> <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Office2007" OnClientLoad="onClientLoad" OnClientItemClosing="onClientItemClosing" EnableRoundedCorners="true" EnableShadows="true"> <Items> <telerik:RadMenuItem Text="File" GroupSettings-Flow="Vertical" GroupSettings-OffsetY="-23" GroupSettings-OffsetX="-6"> <Items> <telerik:RadMenuItem Text="Save As" ImageUrl="images/14SaveAs.gif" GroupSettings-Flow="Vertical" GroupSettings-OffsetY="-1"> <Items> <telerik:RadMenuItem Text="Word Document" ImageUrl="images/41worddoc.gif" /> <telerik:RadMenuItem Text="Word Template" ImageUrl="images/42wordtmpl.gif" /> <telerik:RadMenuItem Text="Word 97 - 2003 Document" ImageUrl="images/43oldword.gif" /> <telerik:RadMenuItem Text="Adobe PDF" ImageUrl="images/44pdf.gif" /> <telerik:RadMenuItem Text="Other formats" ImageUrl="images/45other.gif" /> </Items> </telerik:RadMenuItem> <telerik:RadMenuItem Text="Print" ImageUrl="images/16print.gif" GroupSettings-Flow="Vertical" GroupSettings-OffsetY="-25"> <Items> <telerik:RadMenuItem Text="Print" ImageUrl="images/16print.gif" /> <telerik:RadMenuItem Text="Quick Print" ImageUrl="images/16print.gif" /> <telerik:RadMenuItem Text="Print Preview" ImageUrl="images/15printPreview.gif" /> </Items> </telerik:RadMenuItem> <telerik:RadMenuItem Text="Publish" ImageUrl="images/16publish.gif" GroupSettings-Flow="Vertical" GroupSettings-OffsetY="-49"> <Items> <telerik:RadMenuItem Text="Run Compatibility Checker" ImageUrl="images/07compatibility.gif" /> <telerik:RadMenuItem Text="Blog" ImageUrl="images/31blog.gif" /> <telerik:RadMenuItem Text="Document Management Server" ImageUrl="images/32docmngr.gif" /> <telerik:RadMenuItem Text="Create Document Workspace" ImageUrl="images/33docwspc.gif" /> </Items> </telerik:RadMenuItem> <telerik:RadMenuItem Text="Send" ImageUrl="images/16send.gif" GroupSettings-Flow="Vertical" GroupSettings-OffsetY="-73"> <Items> <telerik:RadMenuItem Text="E-mail" ImageUrl="images/21email.gif" /> <telerik:RadMenuItem Text="Create Adobe PDF and Email" ImageUrl="images/22emailpdf.gif" /> <telerik:RadMenuItem Text="Create Adobe PDF and Send for Review" ImageUrl="images/23reviewpdf.gif" /> <telerik:RadMenuItem Text="Internet Fax" ImageUrl="images/24inetfax.gif" /> </Items> </telerik:RadMenuItem> <telerik:RadMenuItem Text="Prepare" ImageUrl="images/16prepare.gif" GroupSettings-Flow="Vertical" GroupSettings-OffsetY="-97"> <Items> <telerik:RadMenuItem Text="Properties" ImageUrl="images/01properties.gif" /> <telerik:RadMenuItem Text="Inspect Document" ImageUrl="images/02inspect.gif" /> <telerik:RadMenuItem Text="Encrypt Document" ImageUrl="images/03encrypt.gif" /> <telerik:RadMenuItem Text="Restrict Permission" ImageUrl="images/04restrictperm.gif" /> <telerik:RadMenuItem Text="Add a Digital Signature" ImageUrl="images/05addsign.gif" /> <telerik:RadMenuItem Text="Mark as Final" ImageUrl="images/06markfinal.gif" /> </Items> </telerik:RadMenuItem> <telerik:RadMenuItem IsSeparator="true" /> <telerik:RadMenuItem Text="Close" ImageUrl="images/17close.gif" /> </Items> </telerik:RadMenuItem> </Items> <ExpandAnimation Type="None" Duration="1" /> <CollapseAnimation Type="None" Duration="1" /> </telerik:RadMenu> <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Configuration" Expanded="true" Orientation="Vertical"> <div class="title" style="padding-bottom: 5px;">Apply custom offset to all items:</div> <asp:Label ID="Label1" runat="server" AssociatedControlID="editOffsetX">Offset X:</asp:Label> <asp:TextBox ID="editOffsetX" runat="server" CssClass="qsfexInput">0</asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="editOffsetX" ErrorMessage="integer between -200 and 200" Display="Dynamic" CssClass="qsfexValidator" /> <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="editOffsetX" Type="Integer" MinimumValue="-200" MaximumValue="200" ErrorMessage="integer between -200 and 200" Display="Dynamic" CssClass="qsfexValidator" /> <div style="height: 5px"></div> <asp:Label ID="Label2" runat="server" AssociatedControlID="editOffsetY">Offset Y:</asp:Label> <asp:TextBox ID="editOffsetY" runat="server" CssClass="qsfexInput">0</asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="editOffsetY" ErrorMessage="integer between -200 and 200" Display="Dynamic" CssClass="qsfexValidator" /> <asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="editOffsetY" Type="Integer" MinimumValue="-200" MaximumValue="200" ErrorMessage="integer between -200 and 200" Display="Dynamic" CssClass="qsfexValidator" /> <asp:Button ID="btnApplyChanges" runat="server" Text="Apply" CssClass="qsfButtonBig" OnClick="btnApplyChanges_Click"></asp:Button> </qsf:ConfiguratorPanel> </div> <script type="text/javascript"> function onClientLoad (sender) { sender.get_items().getItem(0).open(); }; function onClientItemClosing (sender, eventArgs) { // prevent first level from closing if (eventArgs.get_item().get_level() == 0) { eventArgs.set_cancel(true); } } </script> <qsf:Footer ID="Footer1" runat="server" /> </form></body></html>
Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.
Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.
If you have any questions, do not hesitate to contact us at sales@telerik.com.