protected void BindMenuListBox() { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } try { _objMenu = new Bill_Sys_Menu(); if (extCIddlMainMenu.Text != "NA") { lstMenu.DataSource = _objMenu.GetChildMenu(Convert.ToInt32(extCIddlMainMenu.Text)); lstMenu.DataTextField = "SZ_MENU_NAME"; lstMenu.DataValueField = "I_MENU_ID"; lstMenu.DataBind(); } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }
void FillChildMenu(TreeNode node) { string MenuID = node.Value; objBillSysMenu = new Bill_Sys_Menu(); //string connString = ConfigurationManager.AppSettings["Connection_String"]; //SqlConnection connection = new SqlConnection(connString); //SqlCommand command = new SqlCommand("select i_menu_id,sz_menu_name from mst_menu where i_parent_id = '" + MenuID + "'", connection); //SqlDataAdapter adapter = new SqlDataAdapter(command); DataSet ChildMenuTable = new DataSet(); ChildMenuTable = objBillSysMenu.GetChildMenu(Convert.ToInt32(MenuID)); // adapter.Fill(ChildMenuTable); if (ChildMenuTable.Tables.Count > 0) { foreach (DataRow row in ChildMenuTable.Tables[0].Rows) { TreeNode newNode = new TreeNode(row["sz_menu_name"].ToString(), row["i_menu_id"].ToString()); newNode.PopulateOnDemand = true; newNode.SelectAction = TreeNodeSelectAction.None; newNode.ShowCheckBox = true; node.ChildNodes.Add(newNode); } } }