/// <summary> /// 获取用户组 /// </summary> /// <param name="Response"></param> private void GetGroups(HttpResponse Response) { ESMonitor.BLL.UserGroup bll = new ESMonitor.BLL.UserGroup(); DataTable dt = bll.GetAllList().Tables[0]; StringBuilder sb = new StringBuilder(); int i = 0; sb.Append("{items:["); foreach (DataRow dr in dt.Rows) { sb.Append("{"); sb.AppendFormat("Id:{0},Name:\"{1}\"", dr["Id"], dr["Name"]); sb.Append("},"); i++; } if (i > 0) { sb = sb.Remove(sb.Length - 1, 1); } sb.AppendFormat("],count:{0}", i); sb.Append("}"); Response.Write(sb.ToString()); return; }
private void BindUserGroups() { ESMonitor.BLL.UserGroup GBll = new ESMonitor.BLL.UserGroup(); DataTable dt = GBll.GetList("").Tables[0]; this.ddlGroup.DataSource = dt; this.ddlGroup.DataTextField = "Name"; this.ddlGroup.DataValueField = "Id"; this.ddlGroup.DataBind(); }