public static Control Create() { TreeStyleMenu result = new TreeStyleMenu(); CreateMainMenu cm = new CreateMainMenu(); DataSet data = cm.GetData(); result.SetMenu(data.Tables[0]); return result; }
private void m_treeViewOne_AfterSelect(object sender, TreeViewEventArgs e) { m_treeViewTwo.Nodes.Clear(); if (e.Node == null) return; TagData tag = e.Node.Tag as TagData; string menuLevel = tag["MenuLevel"].ToString(); string filter = string.Format("Len(MenuLevel) > {0} and SubString(MenuLevel, 1, {1}) = {2} and MenuCaption <> '-' ", menuLevel.Length, menuLevel.Length, menuLevel); DataRow[] rows = m_mainMenuTable.Select(filter, "MenuLevel"); CreateMainMenu createMainMenu = new CreateMainMenu(); DataSet data = new DataSet(); DataTable table = new DataTable(); data.Tables.Add(table); table.Columns.Add("MenuCaption"); table.Columns.Add("MenuLevel"); table.Columns.Add("ActionId"); table.Columns.Add("AssemblyName"); table.Columns.Add("ClassName"); table.Columns.Add("MethodName"); table.Columns.Add("ObjId"); foreach (DataRow row in rows) { table.Rows.Add(new object[] { row["MenuCaption"], row["MenuLevel"], row["ActionId"], row["AssemblyName"], row["ClassName"], row["MethodName"], row["ObjId"]}); } createMainMenu.Execute(data, m_treeViewTwo); m_treeViewTwo.ExpandAll(); }