private void c1FlexGrid1_BeforeEdit(object sender, C1.Win.FlexGrid.RowColEventArgs e) { // if we begin to edit auto fill the date field if (e.Row > 1 && (e.Col == 2 || e.Col == 3)) { if (c1FlexGrid1[e.Row, 1] == null) { if (c1FlexGrid1[e.Row - 1, 1] != null) { c1FlexGrid1[e.Row, 1] = ((DateTime)c1FlexGrid1[e.Row - 1, 1]).AddDays(1); } } } }
private void c1FlexGrid1_AfterEdit(object sender, C1.Win.FlexGrid.RowColEventArgs e) { //After edit, apply new changes to calculated columns if (isHeaderRow(e.Row)) { //If header row remove all numeric data if it exists and apply custom Heading CellStyle ClearRow(e.Row); this.c1FlexGrid1.SetCellStyle(e.Row, 0, c1FlexGrid1.Styles["Heading"]); } else { //Calculate new totals for current row CalculateGrossMargins(e.Row); CalculateDeviation(e.Row); } //Calculate new deviation for adjacent affected row CalculateDeviation(e.Row + 1); }