Oct 20, 2012, 4:06 PM
Ext.NET Menu Panel dynamically created using loader
hi,
i'm trying to dynamically load items to the menu panel using the loader method. but only the top level menu item is loads. the child menu item is not loading.
Below is the code.
test.aspx
thanks in advance
i'm trying to dynamically load items to the menu panel using the loader method. but only the top level menu item is loads. the child menu item is not loading.
Below is the code.
test.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="testext.test" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:ResourceManager runat="server">
</ext:ResourceManager>
<ext:Panel ID="Panel1" runat="server" Header="false" Border="false" Region="West"
Layout="AccordionLayout" Margins="5 0 5 5" Split="true" Collapsible="true" Title="Navigation"
Width="175" MinWidth="175" TitleCollapse="true" Floatable="false" Height="350">
<Loader runat="server" Url="LeftMenuServices.asmx/GetLeftMenu" Mode="Component">
<AjaxOptions Json="true" />
<LoadMask ShowMask="true" Msg="Loading" />
</Loader>
</ext:Panel>
</div>
</form>
</body>
</html>
LeftMenuServices.asmx.csusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using Ext.Net;
namespace testext
{
/// <summary>
/// Summary description for LeftMenuServices
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class LeftMenuServices : System.Web.Services.WebService
{
[WebMethod]
public void GetLeftMenu()
{
LeftMenu leftMenuBL = new LeftMenu();
List<AbstractComponent> leftMenuItems = new List<AbstractComponent>();
MenuPanel menuPanel = new MenuPanel
{
ID = "menu1",
Icon = Icon.Briefcase,
Title = "Menu 1"
};
Menu childmenu1 = new Menu();
childmenu1.Add(new MenuItem
{
ID = "childmenu1",
Icon = Icon.ArrowRight,
Text = "SubMenu 1"
});
menuPanel.Menu.Add(childmenu1);
leftMenuItems.Add(menuPanel);
MenuPanel menuPanel2 = new MenuPanel
{
ID = "menu2",
Icon = Icon.Mail,
Title = "Menu 2"
};
Menu childmenu2 = new Menu();
menuPanel2.Menu.Add(childmenu2);
leftMenuItems.Add(menuPanel2);
ComponentLoader.Render(leftMenuItems);
}
}
}
outputthanks in advance