I’m using an ASPxGridview bound to a SqlDatasource, and I was wondering if there was a I can do just a partial refresh of the grid?
Right now when I want to refresh the display of the grid I initiate a callback (grid.PerformCallback(‘REBIND’), but that refreshes the entire grid, what I’d like to be able to do is just refresh one row (the grid is just displaying the data, the changes to the data are being done elsewhere).
The ASPxGridView does not allow you to refresh a row partially, because the entire grid's table is refreshed when a callback is handled.
Even if the grid allows this functionality, the SqlDataSource does not allow you to do this, because it does not have appropriate interfaces, allowing you to retrieve a single row from a database.
I suggest that you examine an approach from the How to perform ASPxGridView instant updating using different editors in the DataItem template example, where the grid is not refreshed when the user changes some values. You can see that in the sample, updated information is sent to the server. However, the grid is not refreshed explicitely. It is not required to refresh the grid, because the user already entered updated values into editors. Thus even if the entered values are refreshed, the user will not see any difference.
I thought that might be the case, but I decided to ask in case there was a way.
I actually did take a look at the example you posted before asking, but in my case I have some of the data changed elsewhere (not using an editor in the grid), so I don’t think that approach would work for me.
Thanks for your response.
Thank you for your reactivation. I regret that my sample was not very helpful.
However, I think that there is a possibility to solve the issue. Unfortunately, I need a sample to see your approach. It would be helpful for me if I could execute it easily.
Is it possible for you to provide me with it?
I will examine the sample and let you know if there is another possible solution.
I don’t know if I can make a sample project with just the relevant information, but in the meantime I’ll try to explain my current approach a little better.
I have a ASPxGridView bound to a SqlDataSource that displays information to the user. I don’t want the users to edit that information directly; rather what I have is buttons in some of the columns (in the data template) that bring up different popups (ASPxPopControl) with forms to edit/add data. However, this data that’s added isn’t the actual data that’s being displayed in the grid; rather the data in the rid is based on that data (I’m using a stored procedure that aggregates data).
When the user closes one of the forms I rebind the grid to refresh the display. What I wanted to do was after a user closes one of the popup forms to refresh just the relevant row, I would still need to refresh the SqlDataSource to run the stored procedure again, but since I know that the only part of the result set that should change is a certain row (based on which row the button the user clicked was), I was hoping that instead of refreshing the entire grid I could just refresh that row.
I appreciate your clarification, and I decided to create a small sample which you can examine.
Since the grid is a simple table, you can modify its cells using templates.
For example, I put labels into cells and change their values when a button is pressed.
Your approach could be the same: when you update labels on the client side, you can send callbacks to the server to update corresponding records. Even if the user refreshes the page, the database server will return fresh records.
Thanks, I believe that should work for my purposes.
Is there a way I can do something similar to update the summary rows to reflect the changes being made client side, because I don’t see a template option for the summary fields?
You can create your own Label control in the Footer Template and update it on the client side as shown in the How to sum values of bound and unbound columns and calculate a total value on the client side example.