Hi,
I have a ObjectDataSource bound to the grid, the initial data load selects the data from the database 4 times using the same select statement, I have tried setting the datasource at runtime and design time with the same results in both cases. I know its not the ObjectDataSource because when I bind it to the standard .NET GridView it only selects the data once.
Secondary problem to this is: I have the webgrid in a warp panel, when sending an asynchronous postback using the warp panel, the webgrid then refreshes the data in the grid 4 times using the same select statement before processing the update/insert/delete operation. This seems excesive and totaly unwanted and unnecessary. The side effect from this is that it retrieves my concurrency control column from the database when it should be using the value that is in the grid.
Any one else have these sorts of problems with the grid?
Thanks
It seems a bit unusual that the grid should be calling select on your data multiple times. It's hard to guess why this is happening without knowing more about your project. The best thing to do would be to take the problem to developer support. They'll be able to help you diagnose what's going wrong.
The grid will refresh the data on each postback. It does this so that it doesn't have to store the row information in ViewState. It shouldn't be doing it four times though, only once. The ObjectDataSource has a caching option (I think the property is called AllowCache) that you might be able to use to avoid having to go back to the database on each postback.
Helen Emerson"] The grid will refresh the data on each postback. It does this so that it doesn't have to store the row information in ViewState. It shouldn't be doing it four times though, only once. The ObjectDataSource has a caching option (I think the property is called AllowCache) that you might be able to use to avoid having to go back to the database on each postback.
How can I force the grid not to refresh on postback? I already have caching on ObjectDataSource, so it doesn't go to the database, but it is still very very slow, because it renders all the rows.
My grid is in a modal popup and on closing this popup I don't want it to refresh, it is going to disappear anyway.
I tried setting the DataSource to null, it doesn't help.
Hi Helen,
Thanks for your response, I have submitted the problem with the select statement running 4 times to deleoper support, hopefully they will be able to shed some light on the issue.
With the data refresh, the problem is that it is refreshing the data before processing the update statement and then again after the update statement.
Here is the scenario:
The data in the grid is now in a detached scenario, I am using a Timestamp column to control concurrency.
I update 1 of the columns in the row, send the postback, the grid retrieves all the data from the database (select *) then performs the update. The problem is that it keeps the data which the user modified on the front end, but replaces all the other data it just retrieved from the database including a new value for my Concurrency control column (It has to keep the old value for the concurrency to work). So now the update works fine but I was expecting a Concurrency Exception to appear because another user modified the data and the current user's data is now stale.
eg.
User 1: Modified CustomerPhone to '98765'
User 2: Modified CustomerPhone to '123345'
User 2: Saved his change which caused the Timestamp column to update.
User 1: Saved his change (The Grid reloaded the data from the DB, but replaced '123345' with '98765', and because it retrieved the new Timestamp, it then performed an update using the new Timestamp - Which is wrong)
User 1: Should have received a concurrency exception, but instead has his data saved - Which appears to be a Last in wins scenario.
The grid should not refresh the data befor performing a update, after the update is fine.
Hope this makes sense.