I have a UltraGrid 9.2 grid that uses a BindingSource that is backed up by simple LINQ query.
The grid updates and deletes are working fine. I am having problems when tabbing off of the "new row". It is not letting me do that. I have filled in all data fields programmatically with valid data but the grid will not let me tab off of that row. If I modify any field on that row then I can tab off of the row and it is marked as dirty, therefore allowing me to save it to the database. I get no warning about why I cannot tab off of that row, it just won't do it. I can find no event being raised where I can warn the user.
Another problem occurs if I do not fill in the fields with valid data on a new row. Some of these columns are marked at not nullable. If I leave these as blank in the grid I would like to warn the user that they need to fill in valid data for that field before trying to commit to the database. Right now it just stops in the last column, not tabbing to the next row and not warning the user.
Thanks for your help.
Steven
Never mind, I figured it out.
I now need to check that all of the fields in the new row are valid before I mark the new row as "a real row". For example, I create a new row but some of the fields are not initialized to valid data. If I tab across the row I need to get an event at the end of the row so that I can then check for data validity before I allow the cursor to go on to then next row.What event is thrown at that point and can I cancel it if the data is invalid?
Thanks
Yes, you understood me correctly. Your solution works perfectly. Thanks
Hi Steven,
I'm not sure I understand the distinction you are making here. You say that you cannot tab out of the addnew row in the grid. And then you say that you CAN tab out if you modify a field in that row.
So I think you are saying that you can't tab out when you set fields programmatically, but you can tab out if you edit the fields via the UI. Is that right?
If that's the case, then my guess is that you need to mark the row as modified by the user. The TemplateAddRow doesn't become a "real" row until the user edits it. So what you have to do is set AddRowModifiedByUser to true on the row's ParentCollection. You can do this at the same time you are setting the values of the required fields in your code.