private void RoleBind(DropDownList ddl, int role_type) { BLL.manager_role bll = new BLL.manager_role(); DataTable dt = bll.GetList("").Tables[0]; ddl.Items.Clear(); ddl.Items.Add(new ListItem("请选择角色...", "")); foreach (DataRow dr in dt.Rows) { if (Convert.ToInt32(dr["role_type"]) >= role_type) { ddl.Items.Add(new ListItem(dr["role_name"].ToString(), dr["id"].ToString())); } } BLL.village villageBll = new BLL.village(); DataTable dtVillage = villageBll.GetParentList(0); ddlTown.Items.Clear(); ddlTown.Items.Add(new ListItem("请选择所属乡镇", "0")); foreach (DataRow dr in dtVillage.Rows) { string Id = dr["id"].ToString(); string Title = dr["name"].ToString().Trim(); ddlTown.Items.Add(new ListItem(Title, Id)); } }
private void LevelBind() { BLL.member_level bll = new BLL.member_level(); DataTable dt = bll.GetList("").Tables[0]; BLL.village villageBll = new BLL.village(); DataTable dtVillage = villageBll.GetParentList(0); ddlTown.Items.Clear(); ddlTown.Items.Add(new ListItem("请选择所属乡镇", "0")); foreach (DataRow dr in dtVillage.Rows) { string Id = dr["id"].ToString(); string Title = dr["name"].ToString().Trim(); ddlTown.Items.Add(new ListItem(Title, Id)); } }