/// <summary> /// 没有子栏目 /// </summary> /// <param name="ParentID"></param> public void LoadParent(long ParentID) { StringBuilder strMenu = new StringBuilder(1000); StringBuilder strChild = new StringBuilder(200); DataTable dt = WebInfoLogic.ParentCategoryID(ParentID); if (dt.Rows.Count > 0) { DataTable dtname = WebInfoLogic.ParentNameByID(ConvertHelper.ConvertLong(dt.Rows[0][0].ToString())); if (dtname.Rows.Count > 0) { //strMenu.Append(string.Format("<div class=\"list_li\" style=\"cursor:pointer\"><a href=\"InfoList.aspx?InfoCategoryID={0}\">{1}", // dt.Rows[0][0].ToString(), dtname.Rows[0][0].ToString()) + "</a></div>"); strMenu.Append(string.Format("<div class=\"list_li\" style=\"cursor:pointer\">{0}", dtname.Rows[0][0].ToString()) + "</div>"); DataTable dtChild = WebInfoLogic.ParentNameByID(ParentID); if (dtChild.Rows.Count > 0) { strChild.Append(string.Format("<ul class=\"list_ul00\">")); strChild.Append(string.Format("<li class=\"list_ul00_li\"><a href=\"Info.aspx?InfoCategoryID={0}\" target=\"_self\">{1}</a></li>", ParentID.ToString(), dtChild.Rows[0][0].ToString())); strChild.Append("</ul>"); } } } leftName.InnerHtml = strMenu.Append(strChild.ToString()).ToString(); }
/// <summary> /// 存在子栏目 /// </summary> /// <param name="ParentID"></param> public void LoadChildContent(long ParentID) { StringBuilder strMenu = new StringBuilder(200); StringBuilder strChild = new StringBuilder(2000); DataTable dtname = WebInfoLogic.ParentNameByID(ParentID); if (dtname.Rows.Count > 0) { //strMenu.Append(string.Format("<div class=\"list_li\" style=\"cursor:pointer\"><a href=\"InfoList.aspx?InfoCategoryID={0}\">{1}", // ParentID.ToString(), dtname.Rows[0][0].ToString()) + "</a></div>"); strMenu.Append(string.Format("<div class=\"list_li\" style=\"cursor:pointer\">{0}", dtname.Rows[0][0].ToString()) + "</div>"); } DataTable dt = WebInfoLogic.GetCategoryName(); DataTable dtParent = WebInfoLogic.ParentNameByID(ParentID); DataRow[] rows = dt.Select("ParentInfoCategoryID=" + ParentID);//查找当前结点的所有子结点 if (dtParent.Rows.Count > 0 && dtParent != null) { leftParent.InnerHtml = dtParent.Rows[0]["InfoCategoryName"].ToString(); if (dt != null && dt.Rows.Count > 0) { strChild.Append(string.Format("<ul class=\"list_ul00\">")); foreach (DataRow row in rows) { if (CheckIsExistChild(ConvertHelper.ConvertLong(row["InfoCategoryID"]))) { strChild.Append(string.Format("<li class=\"list_ul00_li\"><a href=\"InfoList.aspx?InfoCategoryID={1}\" target=\"_self\">{0}</a></li>", row["InfoCategoryName"].ToString(), row["InfoCategoryID"].ToString())); } else { strChild.Append(string.Format("<li class=\"list_ul00_li\"><a href=\"Info.aspx?CategoryID={1}&InfoCategoryID={2}\" target=\"_self\">{0}</a></li>", row["InfoCategoryName"].ToString(), row["InfoCategoryID"].ToString(), ParentID)); } } strChild.Append("</ul>"); leftName.InnerHtml = strMenu.Append(strChild.ToString()).ToString(); } else { leftName.InnerHtml = "暂无相关信息..."; } } }
public void ChildContent(long ParentID) { //if (ParentID == 0) //{ // if (CheckIsExistChild(ParentID)) // { // LoadChildInfo(); // } //} //else //{ // LoadChildInfo(); //} StringBuilder strMenu = new StringBuilder(200); DataTable dt = WebInfoLogic.GetCategoryName(); DataTable dtParent = WebInfoLogic.ParentNameByID(ParentID); DataRow[] rows = dt.Select("ParentInfoCategoryID=" + ParentID);//查找当前结点的所有子结点 if (dtParent.Rows.Count > 0 && dtParent != null) { leftParent.InnerHtml = dtParent.Rows[0]["InfoCategoryName"].ToString(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in rows) { if (CheckIsExistChild(ConvertHelper.ConvertLong(row["InfoCategoryID"]))) { strMenu.Append(string.Format("<li class=\"list_li\"><a href=\"Info.aspx?InfoCategoryID={1}\" target=\"_self\">{0}</a></li>", row["InfoCategoryName"].ToString(), row["InfoCategoryID"].ToString())); } else { strMenu.Append(string.Format("<li class=\"list_li\"><a href=\"InfoList.aspx?CategoryID={1}&InfoCategoryID={2}\" target=\"_self\">{0}</a></li>", row["InfoCategoryName"].ToString(), row["InfoCategoryID"].ToString(), ParentID)); } } leftName.InnerHtml = strMenu.ToString(); } else { leftName.InnerHtml = "暂无相关信息..."; } } }