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.
Arun's tip didnt work....and neither did yours...
So lets go back to the original question....
When you have the grid set to add new rows...and you have your gray edit row....and you drop the cursor on a cell of it...the edit cursor blinks in the cell...
Here is the key...until you start typing you don't actually get the new row that drops down in the GUI/Grid...your just sitiing there with your with the edit cursor blinking in the gray row...
So if you do nothing and bail out...and come back in...their is new empty row saved..by merley placing the cursor in the gray add row it calls the underlyer to add a new element....
If you type somthing then we get that new drop down row in the grid...the grid does this....visually you dont get a new row in the GUI until you type somthing.....
What I want is to stop the grid from adding a new row unless or until that new grid GUI row drops into the mix...the one the grid produces the moment you start typing...In other words...I want the grid to tell the source to add a row ONLY IF I TYPE SOMTHING...I only want the gird to tell the source to ADD a row when it ADD'S a ROW...
Seems pretty obvious that the grid should do this...What am I missing?
What event is that?
Mike Saltzman"]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.
He he...down the rabbit hole we go...another interface to fold not so seamlessly at first into my app...
Thanks to both of you...