I have a grid bound to a class that implements the IBindingList interface.
If I put the cursor on a cell of the add new row...it instantly tells the bound class to add a new row...even if I dont enter any data...
I end up saving new empty rows...
Simple enough to clean them out when saving the data by sniffing the empty rows and dumping them...
Would be better to be able to supress the binding update unless or until there is actual data put in the cell...
Of course the grid needs the new row to actually be able to type into it so to speak...but is there anyway to make the grid clean up after itself if the user does not enter data in the cell.
Any suggestions?
CW
In order for the grid to display an AddNew row, there has to be a row in the underlying data source. So there is no way to prevent the grid from asking the BindingManager to add a new row.
What you probably need to do here is implement IEditableObject. This is the interface that most data source, such as the DataTable, use to allow the creation and cancellation of new rows.
HI,
plz code the foll..
Set the Grids Updatemode to OnRowChangeOrLostFocus
In BEforeRowUpdate event
if e.Row.IsAddRow then
{
//include all ur validations
if Not valid then
e.cancel=true // this cancels the row addtion
}
If u want all the entered text or selectesd value in the add row to be retained ,
then set the RowupdateCancelAction to RetainDataAndActivation, //by default this will be cancelupdate
hope this helps u ..
hppy koding,
Arun