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
627
mismatch between the webGrid on the client and the one on the server
posted

Hi,

I'm using NetAdvantage v8.3 and I'm facing a weird issue. The WebGrid presented on the client is changed by the user during the session and when he press 'Save' button the server iterates over the grid row by row and send relevant details to the DB.

The issue is that the servr does not get the current version of the grid. meaning, the rows contain the data that was before the user changed it... (Actually, the grid that the server reads is different from the grid that the user see, which is the relevant one).

It's happen mostly when I'm using grid sort on the client (by javascript)...

Any idea? it's not the first time I'm having this issue.

Please advice

Thanks,

Maya

Parents
No Data
Reply
  • 45049
    Suggested Answer
    posted

    Maya,

    This sounds like a timing issue.  My best suggestion is to use a different approach.

    mbakshi said:
    and when he press 'Save' button the server iterates over the grid row by row and send relevant details to the DB.

    I recommend using a combination of the UpdateRowBatch event of the grid, instead of iterating across the grid row-by-row.

    I also recommend ensuring that your data source has a unique identifier (such as a PrimaryKey in a DataTable), and to set the DataKeyField of each band to match this unique identifier.  This will help the grid uniquely identify each row during the UpdateRowBatch event, even if the rows are sorted and/or filtered on the client.

    In addition to being more certain that you'll identify the correct rows, you'll get better performance.  UpdateRowBatch will be raised once for each row that is changed, as opposed to iterating through the entire grid.

    If you need to re-bind your grid after all the operations are complete, or if you'd like to send all the updates made in a single operation, you can do this in the button's Click event, since this will occur after all UpdateRowBatch events have been rasied for a particular postback.

Children