/// <summary>Handles the <see cref="GridView.RowCommand"/> event of the <see cref="StatusesGrid"/> 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 StatusesGrid_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.cvDuplicateStatus.IsValid = false; return; } ApplicationStatus.UpdateStatus(statusId.Value, newStatusName); this.StatusesGrid.EditIndex = -1; this.BindData(); }