Hi,
I tried to test a dynamic menu control, and everything is fine except the sub menu items are not showing up.
What I am thinking is that when this dynamic control is inherited from RadMenu, it does not inherit the javascript side of the control. In other words, the behaviors of the control does not automatically inherits from the RadMenu.
Here, it only shows "aaa" in the first level, but "bbb" is not showed up when I hovered on the "aaa".
Anyone has any advise or an alternative solution?
Thanks.
I tried to test a dynamic menu control, and everything is fine except the sub menu items are not showing up.
What I am thinking is that when this dynamic control is inherited from RadMenu, it does not inherit the javascript side of the control. In other words, the behaviors of the control does not automatically inherits from the RadMenu.
Here, it only shows "aaa" in the first level, but "bbb" is not showed up when I hovered on the "aaa".
| namespace AjaxServerControl1 |
| { |
| [ClientScriptResource("Telerik.Web.UI.RadMenu", "Telerik.Web.UI.Menu.RadMenuScripts.js")] |
| [Designer("Telerik.Web.Design.RadMenuDesigner, Telerik.Web.UI, Version=2008.03.1125.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4")] |
| public class ServerControl1 : RadMenu, IScriptControl |
| { |
| protected override IEnumerable<ScriptDescriptor> |
| GetScriptDescriptors() |
| { |
| ScriptControlDescriptor descriptor = new ScriptControlDescriptor("AjaxServerControl1.ClientControl1", this.ClientID); |
| yield return descriptor; |
| } |
| // Generate the script reference |
| protected override IEnumerable<ScriptReference> |
| GetScriptReferences() |
| { |
| yield return new ScriptReference("AjaxServerControl1.ClientControl1.js", this.GetType().Assembly.FullName); |
| } |
| #region IScriptControl Members |
| IEnumerable<ScriptDescriptor> IScriptControl.GetScriptDescriptors() |
| { |
| return GetScriptDescriptors(); |
| } |
| IEnumerable<ScriptReference> IScriptControl.GetScriptReferences() |
| { |
| return GetScriptReferences(); |
| } |
| #endregion |
| } |
| } |
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <%@ Register Assembly="AjaxServerControl1" Namespace="AjaxServerControl1" TagPrefix="cc"%> |
| <!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> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"></telerik:RadScriptManager> |
| <cc:ServerControl1 ID="menu" runat="server"> |
| <Items> |
| <telerik:RadMenuItem Text="aaa"> |
| <Items> |
| <telerik:RadMenuItem Text="bbb"></telerik:RadMenuItem> |
| </Items> |
| </telerik:RadMenuItem> |
| </Items> |
| </cc:ServerControl1> |
| </div> |
| </form> |
| </body> |
| </html> |
Anyone has any advise or an alternative solution?
Thanks.