private void HienThiDuLieuCapCon(TreeNode nodecha) { nodecha.Nodes.Clear(); try { menuBL ctr = new menuBL(); DataTable dt = new DataTable(); dt = ctr.GetAll(); DataRow[] arrdr = dt.Select("parentmenuid=" + nodecha.Name, "menuorder asc,menuname asc"); for (int i = 0; i < arrdr.Length; i++) { TreeNode node = nodecha.Nodes.Add(arrdr[i]["menuid"].ToString().Trim(), arrdr[i]["menuname"].ToString().Trim()); HienThiDuLieuCapCon(node); } } catch { } }
private void HienThiDuLieu() { try { menuBL ctr = new menuBL(); DataTable dt = new DataTable(); dt = ctr.GetAll(); DataRow[] arrdr = dt.Select("parentmenuid=0", "menuorder asc,menuname asc"); TreeNode nodecha = treeView1.Nodes.Add("0", "DANH MỤC CHỨC NĂNG"); //nodecha.SelectedImageKey = "1"; for (int i = 0; i < arrdr.Length; i++) { TreeNode node = nodecha.Nodes.Add(arrdr[i]["menuid"].ToString().Trim(), arrdr[i]["menuname"].ToString().Trim()); //node.SelectedImageKey = "0"; } } catch { } }