private void addsubcolumn(DataTable tempTable, string pi_cid, string pi_cname) { TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); //先插入当前栏目 DataRow dr = tempTable.NewRow(); dr["cid"] = pi_cid; dr["cname"] = pi_cname; if (JpRoles.ifhaveAuthorRoleBycidanduid(Session["uid"].ToString(), pi_cid) == true && JpColumns.ifhotpublish(pi_cid) == false) { //有下一级 if (JpColumns.isHaveSubColumn_online(pi_cid) == true) { } else { tempTable.Rows.Add(dr); } } //判断是否有下级栏目 DataTable dt = new DataTable(); dt = JpColumns.GetColumns(pi_cid); if (dt.Rows.Count > 0) { //有下一级目录 for (int i = 0; i < dt.Rows.Count; i++) { addsubcolumn(tempTable, dt.Rows[i]["cid"].ToString(), pi_cname + ">>" + dt.Rows[i]["cname"].ToString()); } } }
private void DeptBind(string cid) { TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dt = new DataTable(); dt = JpColumns.GetColumns(""); DataTable tempTable = dt.Clone(); for (int i = 0; i < dt.Rows.Count; i++) { addsubcolumn(tempTable, dt.Rows[i]["cid"].ToString(), dt.Rows[i]["cname"].ToString()); } ddlcolname.DataSource = tempTable; ddlcolname.DataTextField = "cname"; ddlcolname.DataValueField = "cid"; ddlcolname.DataBind(); }
private void addsubcolumn(DataTable tempTable, string pi_cid, string pi_cname) { //先插入当前栏目 DataRow dr = tempTable.NewRow(); dr["cid"] = pi_cid; dr["cname"] = pi_cname; tempTable.Rows.Add(dr); //判断是否有下级栏目 TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dt = new DataTable(); dt = JpColumns.GetColumns(pi_cid); if (dt.Rows.Count > 0) { //有下一级目录 for (int i = 0; i < dt.Rows.Count; i++) { addsubcolumn(tempTable, dt.Rows[i]["cid"].ToString(), pi_cname + ">>" + dt.Rows[i]["cname"].ToString()); } } }