We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problems to refresh a sheet with Ajax by handling event


I am using Aspose.Cells for .NET to create a Web Application.
I am facing a problem to refresh a sheet by handling event. I am using Ajax (EnableAjax = true) and Internet Explorer 7 and 8.

I have some buttons outside of the control to apply some event on the control.

For example I have a button to filter data inside the control. By clicking on this button which is outside the control I get a list of data contained in the gridWeb (4 lines for example). I select one of these line and apply the filter. The sheet isn’t refreshing…
By applying the filter I call again all my methods used to initialize the sheet (one for the style and another for the data). But nothing happened.
I have to switch to another sheet and go back to the sheet on which I have applied the filter to see the modifications.

I don’t understand why Ajax is not working on this case because it works fine for other event.
For example when I navigate between differents sheets, each sheet is displaying well and I call the same methods to display it (Initialize the style, setting the data).

Is there a known issue with Ajax when the event comes from a button which is not in the GridWeb ?

Thanks for your answers.


Please provide us a sample web project/application with our latest Aspose.Cells.GridWeb v2.7.19.2xxx(you may download Aspose.Cells for .NET v7.5.0 package and install it to get the latest GridWeb version), zip it and post it here to reproduce the issue on our end. We will check it soon.

Thank you.

Thanks for your quick answer.

My collegue is working on a sample project to share with you our issues.
We will provide it to you as soon as we can.


Please find in attachement to this post a sample project that shows the refresh issue.

If you look at the code, when you click on the second tab sheet, the custom command button is supposed to be hidden. But as the refresh is not working it is still displayed. The problem appears in every browser (Internet Explorer and Firefox).

Thanks for your consideration.


Thanks for the sample project.

After an initial test, I observed the issue as you mentioned by running your project. In the event handler for OnSheetTabClick event, as you are hiding the button when we navigate to Sheet2, but the custom command button is still displayed. We need to look into your issue in details. I have logged a ticket with an id “CELLSNET-41796” for your issue.

Once we have any update on it, we will let you know here.

Thank you.

Thanks for your quick answer.
I hope you will find a solution for this problem !


Could you try to add/update the following code accordingly for your needs, you may refer to it:

Sample code:

private void InitializeCalculationArea(DataTable dt)
if (this.gridWebCalculationArea.ActiveSheetIndex == 0)
// this.CustomGridBtnCmd1.Visible = true;
--> this.gridWebCalculationArea.CustomCommandButtons[0].Visible = true;
else if (this.gridWebCalculationArea.ActiveSheetIndex == 1)
// this.CustomGridBtnCmd1.Visible = false;
–> this.gridWebCalculationArea.CustomCommandButtons[0].Visible = false;

InitializeCalculationArea(dt, this.gridWebCalculationArea.ActiveSheetIndex);

So, you will use this kind of way to get button’s instance, this.CustomGridBtnCmd1 and this.gridWebCalculationArea.CustomCommandButtons[0] are different objects.

Thank you.


Well you are right it fixes the issue with the custom command button.

But in fact it’s not the refresh issue.
I have created two new samples project to allow you understand the issue.


In this example the DataSource contains only 5 rows. You can test two features :
- the button fill 3 which is supposed to change the DataSource and refresh the control with the new data => doesn’t work no refresh. But if I use an aspose feature after using the Fill3 button (i.e Add Row) it adds a row and it refreshes the sheet with the right DataSource.
- the custom command button “Add” which insert a new row in the DataSource and refresh the control. The row is not added in the control whereas in the DataTable. It erases the current row and doesn’t expand the row number on the sheet.


In this example the DataSource contains 50 rows. You have the same two features :
- the button fill 3 which doesn’t work too.
- the custom command button “Add” which in this case works !
And I think it’s because of the number of rows. We have 50 rows so the control create a vertical scrollbar. When you add a row, the control is refreshing because of the scrollbar (a refresh on aspose side ? In JavaScript ?). So we have the new row and if we scroll down you can see the loading bar and when the sheet is loaded we have now 51 rows instead of 50.


Is there some news for this issue ?
It is a big one I know but also very important for my project.



I have tested your sample projects you shared in your previous post:

I could not evaluate it properly, there is “Apply new fill” button in both projects. After clicking the button, when I click on the custom command button “Add”, I got the exception: “Input string was not in a correct format.”. Could you elaborate it in details and also provide complete steps and their sequence involved to reproduce the issue on our end, it may help us to analyze your issue properly.

Also, by the way, our concerned developer is already working over it. Once we have any update on it, we will let you know here.

Thank you.

Ok I will explain the steps I have followed.

In the sample project WebApplication1 :

- Click on sheet2 : the sheet fills with the DataTable => you have 5 rows
- Click on the button “Fill2” : a div appears with a new button “Apply new fill”
- Click on the button “Apply new fill” : it is supposed to reload the sheet with a new DataTable but it doesn’t work => refresh issue
- Click on the custom command button “Add” : it is supposed to add a row at the row index of the active cell but it doesn’t work => it erases the current row with the new and you still have 5 rows (instead of 6).

In the sample project WebApplication2 :

- Click on sheet2 : the sheet fills with the DataTable => you have 50 rows
- Click on the button “Fill2” : same behavior than WebApplication1 the reload of the sheet doesn’t work.
- Click on the custom command button “Add” : it works fine ! The new row is properly added you can see that you have now 51 rows.

The only difference between the two project is that you have 50 rows in WebApplication2 and then a vertical scrollbar.

If you need more information let me know !



Thanks for providing further details.

I have tested your scenario with your projects using your mentioned steps, I observed some issues. I have logged your projects against your existing issue “CELLSNET-41796”. Our concerned developer will look into it soon.

Thank you.

We have investigated your project WebApplication1 further:

1) refresh issue, you shall set PostBackUrl="~/Default.aspx" for btnFill3.
2) It is supposed to add a row at the row index of the active cell but it doesn't work => it erases the
if (command.Split('/').Length == 4)
string commandType = command.Split('/')[0];
int sheetTabIndex = Convert.ToInt32(command.Split('/')[1]);
int rowIndex = Convert.ToInt32(command.Split('/')[2]);
int columnIndex = Convert.ToInt32(command.Split('/')[3]);

When we debug the code segment, we can see the command is:add/undefined/0/0 so the below code will fail! We think those errors are actually your own business logic flaws or mistakes. Please look into WebApplication2 by yourself. I am afraid, we don't have more time to investigate more projects till you really got stuck for your own logic, please correct them by yourself.

Thank you.


For the refresh issue it works fine with the parameters PostBackUrl ! Thanks a lot !

For the add row custom command button, I don’t understand how you did to get a sheetTabIndex undefined.
I have just made some tests on each sheet and sheetTabIndex contains the right value but the method still erases the current row.

Please try again with the sample project attached to this post.



When I run your newly attached project and click on “Add” custom button, I got the exception as we already mentioned in one of our previous posts, see the attached screen shot here.

Thank you.

As you can see on my screenshots attached it works fine for me.

I am pretty sure you are testing it with Firefox and the JavaScript code is optimized for Internet Explorer :wink:
Try on IE and you’ll see that you will not have the exception again.


Thanks for providing us further details.

Well, you are right, it works fine in IE browser type without any exception, when I clicked on the “Add” custom command button, new row is added but replacing the previous row at the location where it is inserting the row. It gives me exception on Google chrome though.

I have logged your comments against your issue “CELLSNET-41796” into our database. Our concerned developer will look into it to figure it out soon.

Thank you.


See the code segment here:
private void InitializeCalculationArea(DataTable dt, int sheetIndex)
this.gridWebCalculationArea.MaxRow = dt.Rows.Count -1 ;
this.gridWebCalculationArea.MaxColumn = dt.Columns.Count - 1;
System.Diagnostics.Debug.WriteLine(“max row:” + this.gridWebCalculationArea.MaxRow);

There is no issue here, see the attached video for reference. The behavior is right, you can see the max row is growing rightly.

Thank you.

I don’t understand it’s working now but we have not changed anything ?!
Why it is working now and not before with the same code ?



We will soon try to provide you the project which is working fine on our end as per the attached video, so you could try it on your end.