First of all, I use the lastest version of the gridweb control.
To explain simply, I have a GridWeb and a Button. My web app open a workbook which contains two worksheets. Here are the differents actions I do :
I modify a cell value in the first Worksheet.
Then I click on the second worksheet tab so it normally loads the second worksheet.
To finish, I click on my button which call a server event.
When I try to access to GridWeb1.ModifiedCells field inside my Button server event, the array is empty. However, I modified a value in the first worksheet.
What I need to do is to get the modified cells of all the worksheets…
Is it a normal behaviour of the ModifiedCells field ? If it is, is there a way to workaround that limitation ?
Looking forward to your early reply, Thank you, Romain.
Do you use Asp.NET button control on the web form/page where you call GridWeb1.ModifiedCells API on its click? If this is the case, you have to sink events for the button’s click for submitted GridWeb’s data.
e.g
//I placed an ASP.NET button named Button1. In Page_Load event, I placed a simple code segment. I imported a simple file and then did sink events for the button’s click.
Now it should work fine. If you still find the issue, kindly do create a sample project (runnable), zip it and post it here to show the issue on our end. Also try our latest version of the product Aspose.Cells.GridWeb v2.7.15.xxxx
You will get the modified cells / updated cells by GridWeb only for the active sheet. So, if you modify a cell in the first worksheet and go to second worksheet and click the top button “Click here”, you will empty for modified cells as you do not update any value for the second worksheet.
In short, if you modify a cell value in the first worksheet and then click on the button, you will get the modified cells details fine.
Indeed, I noticed that if I just modify a cell value and then click on the button it displays the details fine.
However, what I don’t understand is why does the grid web control empty modified cells field on each postback. For example, if you modify a cell and you click on the button, you will get the modified cells details fine. But if you click again on the button you will get no modified cell.
I think this behavior is very strange, I thought that the grid would keep in memory all the modification the user made whatever his worksheets navigation.
Do I have to conclude that this is wanted behavior?
Yes, we noticed this behavior, I think it is due to by design and might be due to performance grounds that when you click on the button second time again, it lost the updated/submitted data of the cells you specified. Anyways, we may look into it.
I think you may try to make use of SheetTabClick or SheetDataUpdated events and try to specify some simple or enhanced variables (e.g you may define some Session level variable objects and try to store your modified cells data into them), so that you may get the data or retrieve the data when you navigate to other sheets accordingly.
Well, I am afraid, GridWeb.ModifiedCells will retrieve your details for the active/current worksheet when you just update/insert some values / data into the cells and use the API etc. So, you have to devise your own approach that suits you more.