I'm using Telerik RadGridView for WinForms. Its data source is a table in a DataSet. The grid view allows user to add, update, and delete rows. Below is how the row update is done:
private void radGridView2_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
{
if (e.OldRow == null)
{
return;
}
DataRowView dataRowView = e.OldRow.DataBoundItem as DataRowView;
if (dataRowView != null)
{
DataRow dataRow = dataRowView.Row;
if (dataRow.RowState == DataRowState.Modified)
{
tableAdapter.Update(dataRow);
}
}
}
What I would like to accomplish is when user press the DEL key on a row, the row is still removed from the grid view but not from the backend database table. Instead, I would like to have an Update on the database table row's colunm (MarkedForDeletion) with a new value.
I'm thinking about intercepting the delete events (UserDeletingRow, or UserDeletedRow, or ?), and then manipulate the DataRow object and then call the tableAdapter.Update(dataRow) as above. What exactly do I need to do?
Thanks!
private void radGridView2_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
{
if (e.OldRow == null)
{
return;
}
DataRowView dataRowView = e.OldRow.DataBoundItem as DataRowView;
if (dataRowView != null)
{
DataRow dataRow = dataRowView.Row;
if (dataRow.RowState == DataRowState.Modified)
{
tableAdapter.Update(dataRow);
}
}
}
What I would like to accomplish is when user press the DEL key on a row, the row is still removed from the grid view but not from the backend database table. Instead, I would like to have an Update on the database table row's colunm (MarkedForDeletion) with a new value.
I'm thinking about intercepting the delete events (UserDeletingRow, or UserDeletedRow, or ?), and then manipulate the DataRow object and then call the tableAdapter.Update(dataRow) as above. What exactly do I need to do?
Thanks!