GridWeb ModifiedCells return only the modified cells of the current worksheet

Hi,

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 :

  1. I modify a cell value in the first Worksheet.
  2. Then I click on the second worksheet tab so it normally loads the second worksheet.
  3. 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.


Hi,


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.

protected void Page_Load(object sender, EventArgs e)
{
//if first visit this page clear GridWeb1
if (!IsPostBack)
{
Button1.Attributes[“onclick”] = “GridWeb1.updateData(); return GridWeb1.validateAll();”;
}
}


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

Thank you.

Hi,

Thank you for your quick reply,

I already use the code you suggested me in the previous post. As you asked me, I made a sample project which will show you the issue.

What you have to do is :

  1. Modify a cell value in the first worksheet.
  2. Click on the second worksheet tab
  3. Click on the top right button labelled "Click here"

The button just checks the ModifiedCells field and displays their coordinates in a client dialog.

Thank you,

Hi,


Thanks for sharing the project.

I have checked your project a bit.

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.

Thank you.

Hi,



Thanks for your reply,



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?



Thank you,

Romain.

Hi,


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.

Thank you.

Hi,

It’s ok that how I am going to do. I asked because it is a pity to do something if the control would handle it.

Thank you,
Romain.

Hi,


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.



Thank you.