/// <summary> /// 綁定市區 /// </summary> private void GetArea() { DAL.AreaDal dalare = new DAL.AreaDal(); int count = 0; var table = dalare.GetDatalistpage(99999, 1, " parent=0", " sort", out count); if (table.Tables.Count > 0) { foreach (DataRow dr in table.Tables[0].Rows) { string Id = dr["id"].ToString(); string Title = dr["title"].ToString().Trim(); ddlAreaid.Items.Add(new ListItem(Title, Id)); var table2 = dalare.GetDatalistpage(99999, 1, " parent=" + Id, " sort", out count); if (table2.Tables.Count > 0) { foreach (DataRow dr2 in table2.Tables[0].Rows) { string Id2 = dr2["id"].ToString(); string Title2 = dr2["title"].ToString().Trim(); Title2 = "├ " + Title2; Title2 = Utils.StringOfChar(2 - 1, " ") + Title2; ddlAreaid.Items.Add(new ListItem(Title2, Id2)); } } } } }
protected string GetPath(string ID) { string HtmlName = ""; //if (PartentID == "0") //{ // HtmlName = "進入區"; //} //if (PartentID != "0") //{ where = " parent=" + ID + ""; DataTable dt = aredal.GetDatalistpage(this.pageSize, this.page, where, " sort", out this.totalCount).Tables[0]; if (dt.Rows.Count > 0) { HtmlName = "進入下級"; } // } return(HtmlName); }
public void GetParent() { int totalCount = 0; DAL.AreaDal aredal = new DAL.AreaDal(); string where = "parent=" + Pid + ""; if (this.id > 0) { where += "and id <> " + id; } var table = aredal.GetDatalistpage(99999, 1, where, " sort", out totalCount).Tables[0]; ddlParent.DataSource = table; ddlParent.DataTextField = "title"; ddlParent.DataValueField = "id"; ddlParent.DataBind(); ddlParent.Items.Insert(0, new ListItem() { Text = "請選擇", Value = "0", Selected = true }); }