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
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 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.
Hi Vince,
Thanks for your repy.
The issue is that I have to get the whole grid as a bundle and insert it into the DB, only after the user have done his updates and approved it. In addition, the user can make a lot of changes during the session and I don't want to post back for very change.
How can primary key of the dataTable solve this issue?
I also found that when exporting to excel the version that is being exported is the one that the server created before the client side updated it (by javaScript). This is serious and worrying issue, since the client and the server's versions are not synchronized...
Thanks
mbakshi said:The issue is that I have to get the whole grid as a bundle and insert it into the DB, only after the user have done his updates and approved it. In addition, the user can make a lot of changes during the session and I don't want to post back for very change.
If you are using the grid's AJAX capabilities, the only difference is that you use the grid's normal updating events, rather than their batch equivalents.
mbakshi said:I also found that when exporting to excel the version that is being exported is the one that the server created before the client side updated it (by javaScript).