Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
880
Stumped with an error message
posted

Hello:

I am using WinGrid .Net v2.0.20062.60510.

The grid displays the data from a table where FirstName is mandatory.

I do a dsDataSet.Update on the _AfterRowUpdate event.

While I add data to the phantom row at the bottom of the grid, and supply thr required data, when I click on an existing row, the databse is updated with no errors.

However, when I click on the new Phantom Row, I get an error message "First Name is mandatory". But the row does get updated in the table.

Can somebody tell my what I am doing wrong?

 

Parents
  • 469350
    Suggested Answer
    Offline posted

    I assume that by "the phantom row" you are referring to the TemplateAddRow.

    As soon as you click on the TemplateAddRow, it becomes an AddRow and a new AddRow is added to the grid's DataSource. So if you call Update on your DataSet at this point, you are trying to save 2 rows, not just one.

    I don't see any way around this. By placing the focus in the AddNewRow, you are essentially in the middle of an edit of a new row and that row is part of the data source, so it will try to get saved.

    It's probably not a good idea to try to update the back end after each individual row update. The DotNet framework is set up to do updates in batches, not one at a time.

Reply Children