public void btnSave_Click(object sender, EventArgs e) { int selectedUserId = this.SelectedUserId; User user = new User(selectedUserId); foreach (ListItem item in this.cblRole.Items) { int roleID = Globals.SafeInt(item.Value, -1); if (item.Selected) { user.AddAssignRole(selectedUserId, roleID); } else { user.DeleteAssignRole(selectedUserId, roleID); } } }