protected void chkboxRoleCheckBox_CheckedChanged(object sender, EventArgs e) { //reference the checkbox that raised this event CheckBox chkboxRoleCheckBox = sender as CheckBox; //get the currently selected user string selectedUserName = drpUserList.SelectedValue; //get the currently selected role string roleName = chkboxRoleCheckBox.Text; //check if role checkbox is checked if (chkboxRoleCheckBox.Checked) { //add user to role for identity if checked m_adminEngine.addUserToRole(selectedUserName, roleName); //display a status message ActionStatus.Text = string.Format("User {0} was added to role {1}", selectedUserName, roleName); } else { //Remove user from role if checked //remove user to role if checked m_adminEngine.removeUserFromRole(selectedUserName, roleName); // Display a status message ActionStatus.Text = string.Format("User {0} was removed from role {1}.", selectedUserName, roleName); } }