/// <summary>Handles the <see cref="GridView.RowCommand"/> event of the <see cref="StatusesGridView"/> control. </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GridViewCommandEventArgs"/> instance containing the event data.</param> private void StatusesGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (!string.Equals("Save", e.CommandName, StringComparison.OrdinalIgnoreCase)) { return; } if (!this.Page.IsValid) { return; } int rowIndex; if (!int.TryParse(e.CommandArgument.ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture, out rowIndex)) { return; } var statusId = this.GetStatusId(rowIndex); if (!statusId.HasValue) { return; } var newStatusName = this.GetStatusName(rowIndex); if (!this.IsStatusNameUnique(statusId, newStatusName)) { this.cvDuplicateUserStatus.IsValid = false; return; } UserStatus.UpdateStatus(statusId.Value, newStatusName); this.StatusesGridView.EditIndex = -1; this.BindData(); }