public void PopulateNodes(TreeNodeCollection nodes, int ParentID) { NewsCategoryModelBll bll = new NewsCategoryModelBll(); DataTable dt = bll.GetList(ParentID); for (int i = 0; i < dt.Rows.Count; i++) { TreeNode tn = new TreeNode(); tn.Text = dt.Rows[i]["catename"].ToString(); tn.Value = dt.Rows[i]["cateid"].ToString(); tn.ImageToolTip = dt.Rows[i]["catename"].ToString(); tn.ToolTip = dt.Rows[i]["catename"].ToString(); nodes.Add(tn); PopulateNodes(tn.ChildNodes, Convert.ToInt32(dt.Rows[i]["cateid"])); } }
public XmlDocument GetData(NameValueCollection TagParameter) { XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\"?><tag />"); XmlNode rootNode = xdoc.SelectSingleNode("/tag"); NewsCategoryModelBll bll = new NewsCategoryModelBll(); DataTable dt = bll.GetList(22); foreach (DataRow row in dt.Rows) { XmlNode CategoryNode = XmlUtility.AddNewNode(rootNode, "category", null); XmlUtility.AddNewNode(CategoryNode, "categoryid", row["cateid"].ToString()); XmlUtility.AddNewNode(CategoryNode, "categoryname", row["catename"].ToString()); } return xdoc; }