I have a datagridview where a user enters a row of data. Upon hitting
the ENTER key, I capture that event and add additional rows based upon
business logic, and delete their original row. As this is a heads-down
data entry app, it must be very speedy and this is not. All of my
other trips back and forth to the server are quite rapid (i.e. data
validation, etc). I have tried collecting the data on the client side
and then submitting it to the server just one time, but everything else
causes an extra blank row in my datagridview. Any suggestions?
tblMMTimeCardTableAdapter.Insert(
((int)tblMMTimeCardDataGridView["tcTimeReportID",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value),
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcEmplid",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((string)tblMMTimeCardDataGridView["tcEmplid",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: null,
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcTRC",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((string)tblMMTimeCardDataGridView["tcTRC",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: null,
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcQty",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((decimal)tblMMTimeCardDataGridView["tcQty",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: 0,
0, //OVT
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcOverrideRt",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((decimal)tblMMTimeCardDataGridView["tcOverrideRt",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: 0,
//Project.Text,
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcProject",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((string)tblMMTimeCardDataGridView["tcProject",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: Project.Text,
//Activity.Text,
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcActivity",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((string)tblMMTimeCardDataGridView["tcActivity",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: Activity.Text,
strEquip,
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcCustomer",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((string)tblMMTimeCardDataGridView["tcCustomer",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: null,
SqlDBUtils.ValueOrDBNull(tblMMTimeCardDataGridView["tcJobcode",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value) != DBNull.Value
?
((string)tblMMTimeCardDataGridView["tcJobcode",
tblMMTimeCardDataGridView.CurrentCellAddress.Y].Value)
: null);