protected void btn_Update_Click(object sender, EventArgs e) { List<SystemUser> oListSystemUser = new List<SystemUser>(); SystemUserBO oSystemUserBO = new SystemUserBO(); Result oResult = new Result(); Boolean bAnyChecked = false; try { oListSystemUser = oListSystemUserForGrid; int[] iArrCheck = new int[oListSystemUser.Count]; for (int i = 0; i < iArrCheck.Length; i++) { iArrCheck[i] = 0; } foreach (GridViewRow oGridRow in Grid_SystemUsers.Rows) { CheckBox oCheckBox = oGridRow.FindControl("deleteRec") as CheckBox; TextBox oTxtPassword = oGridRow.FindControl("txtPassword") as TextBox; TextBox oTxtName = oGridRow.FindControl("txtUserName") as TextBox; TextBox oTxtEmail = oGridRow.FindControl("txtEmail") as TextBox; if (oCheckBox.Checked) { bAnyChecked = true; //if (oListSystemUser[oGridRow.RowIndex].SystemUserName.ToLower().Equals("administrator") && IsValidSystemUserPassword(oTxtPassword.Text)) if (IsValidSystemUserPassword(oTxtPassword.Text)) { oListSystemUser[Grid_SystemUsers.PageIndex * Grid_SystemUsers.PageSize + oGridRow.RowIndex].SystemUserPassword = oTxtPassword.Text; } if (IsValidSystemUserName(oTxtName.Text, oListSystemUser)) { oListSystemUser[Grid_SystemUsers.PageIndex * Grid_SystemUsers.PageSize + oGridRow.RowIndex].SystemUserName = oTxtName.Text; } if (ISvalidEmail(oTxtEmail.Text)) { oListSystemUser[Grid_SystemUsers.PageIndex * Grid_SystemUsers.PageSize + oGridRow.RowIndex].SystemUserEmail = oTxtEmail.Text; } iArrCheck[Grid_SystemUsers.PageIndex * Grid_SystemUsers.PageSize + oGridRow.RowIndex] = 1; } //else //{ // iArrCheck[oGridRow.RowIndex] = 0; //} } if (bAnyChecked) { oResult = oSystemUserBO.UpdateSystemUser(oListSystemUser, iArrCheck); if (oResult.ResultIsSuccess) { //oListSystemUser = (List<SystemUser>)oResult.ResultObject; ////Utils.SetSession(SessionManager.csStoreGridView, oListSystemUser); //this.ViewState.Add(SessionManager.csStoreGridView, oListSystemUser); //Grid_SystemUsers.DataSource = oListSystemUser; //Grid_SystemUsers.DataBind(); lbl_error.ForeColor = Color.Green; lbl_error.Text = oResult.ResultMessage; LoadSystemUsersToGrid(true, iArrCheck); } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = oResult.ResultMessage; } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = "Please Select a System User."; } } catch (Exception oEx) { lbl_error.ForeColor = Color.Red; lbl_error.Text = "System user Update Exception."; } }