private void EnvelopeLineDataTable_ColumnChanged(object sender, DataColumnChangeEventArgs e) { if (stayOut) { return; } stayOut = true; EnvelopeLineRow row = e.Row as EnvelopeLineRow; if (e.Column.ColumnName == "amount") { decimal newValue; int tempValue; // only keep two decimal points newValue = Convert.ToDecimal(e.ProposedValue); tempValue = Convert.ToInt32(newValue * 100); newValue = Convert.ToDecimal(tempValue) / 100; // allow negative values in this column row.amount = newValue; } stayOut = false; }
///////////////////////// // Internal Events private void EnvelopeLineDataTable_TableNewRow(object sender, DataTableNewRowEventArgs e) { stayOut = true; EnvelopeLineRow newRow = e.Row as EnvelopeLineRow; newRow.id = this.newID++; //newRow.lineItemID = this.currentLineID; newRow.envelopeID = SpclEnvelope.NULL; newRow.description = ""; newRow.amount = 0.0m; stayOut = false; }