namespace Smartkid.ESchool.Web.UserControl ...{ using System; using System.Data; using System.Drawing; using System.Web; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Collections; /**////<summary> /// Summary description for BuildMenuTree. ///</summary> publicclass BuildMenuTree : System.Web.UI.UserControl ...{ int index =0; privatevoid Page_Load(object sender, System.EventArgs e) ...{ // Put user code to initialize the page here BuildTree(1); } Web Form Designer generated code#region Web Form Designer generated code overrideprotectedvoid OnInit(EventArgs e) ...{ // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /**////<summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. ///</summary> privatevoid InitializeComponent() ...{ this.Load +=new System.EventHandler(this.Page_Load); } #endregion publicvoid BuildTree(int pPID) ...{ if(BusinessFacade.Service.II_Menu_Service.Instance.GetSubMenu(pPID) !=null&& BusinessFacade.Service.II_Menu_Service.Instance.GetSubMenu(pPID).Count>0) ...{ IList iList = BusinessFacade.Service.II_Menu_Service.Instance.GetII_MenuListByPID(pPID); int id =0; index++; foreach(BusinessFacade.II_Menu iI_Menu in iList) ...{ if(iI_Menu.ID != pPID) ...{ id++; Response.Write(index.ToString()+iI_Menu.Name+""id=""+id.ToString()+"<br>"); BuildTree(iI_Menu.ID); } } index--; } } } }