private void RemoveRole() { MainSecurity ms = new MainSecurity(); DataTable dt = ms.GetRoleAsTable(lblUserName.Text, 1); string ids = ","; foreach (DataRow dr in dt.Rows) { ids += dr[0].ToString() + ","; } if (ids.Length > 1) { ArrayList al = new ArrayList(); foreach (ListItem li in lbxRole.Items) { if (ids.Contains("," + li.Value + ",")) { //al.Add(li); li.Enabled = false; } } if (al != null && al.Count > 0) { foreach (ListItem item in al) { lbxRole.Items.Remove(item); } } } }