Free Support Forum -

GridWeb Hidden comments, UpdatePanel and access from ASP buttons


I am using Aspose.Cells.GridWeb version 20.4 in .Net.
I came across some issues for which I have found no solution or clarification even though there are some old topics about some of them.

I created a Sample project with three pages (one for each issue). It is available here:Sample project

  1. The first problem is the use of the GridWeb inside an UpdatePanel without using AJAX (EnableAJAX=“false”):

         <asp:UpdatePanel ID="updGrid" runat="server" UpdateMode="Conditional">
                 <acw:GridWeb ID="grid" runat="server" EnableAJAX="false"  >	

When I try to do this the grid becomes unformatted and unresponsive after the first operation that is performed.
I would like to know if I am supposed to be able to use UpdatePanels and how can I do it. In the sample project I included the solutions I tried to apply as described in very old topics about this issue. However they did not work.

  1. The second issue is also discussed on old topics, but the provided solutions did not work. I would like to know if the active / selected cells can be accessed from a button outside the GridWeb component. Currently I can only access this information through the grid’s command buttons.

  2. Finally, when a comment is created on the first line of the grid it shows partially hidden. Also, the bottom line of the grid sometimes disappears when comments are present. Is there anything I can do about it?
    With this comment:

         grid.ActiveSheet.Cells[0, 0].CreateComment("An example of a comment.", "", false);

The result is this:
image.png (2.4 KB)

I would appreciate any help.

Thank you for your query. We are analyzing your query and will share our feedback soon.

It seems that you have shared some different project as it does not contain three pages. Please confirm if correct solution is shared or not.

  1. Regarding the first issue, could you explain in detail what is the issue and how to observe it along with the images showing the difference between the two scenarios when EnableAJAX is set to false and true?
  2. For the second issue, have you tried any scenario? If yes please share that code as well for our testing.
  3. Please ensure that the solution contains code for this issue as well where the comment is set for a cell.

Hi, I am sorry, you are right I copied the wrong link.
I corrected the link for the sample project in the original post. It is here as well: Sample project

There is one page for each issue:

  • GridInsideUpdatePanel.aspx for the first

  • AccessActiveCell.aspx for the second

  • HiddenComments.aspx for the comments

I included the solutions I have tried. They are commented.

Answering your questions:

  1. When I have a grid inside an UpdatePanel with EnableAJAX=false. It shows correctly when it first opens:
    image.png (1.7 KB)
    However, if I, for example, double click a cell the grid stretches and I can no longer do the double click or any other operation:
    image.png (1.9 KB)
    I notice that this will not happen with EnableAJAX=true. In this mode the grid remains with the same behavior as when it first opens. However I cannot use this mode in my project.
    I tried applying my license and using the key ‘aspose.cells.gridweb.force_script_path’ both true and false. And I also tried the following line of code as seen in some very old posts:

    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "GridWeb_JS", "new acwmain(document.getElementById('" + grid.ClientID + "'))", true);
  2. For accessing the ActiveCell from an ASP:Button I added the following line on PageLoad and then on the OnLoad event of the grid:

    btnAccessValue.Attributes["onclick"] = "grid.updateData(); return grid.validateAll();";

I saw some old posts with this suggestion but it didn’t work in my project.

  1. Finally, yes there is a page for the comments issue.

Thanks, for the fast reply.

We were able to observe the issues but we need to look into them more. We have logged the issues in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issues have been logged as

CELLSNET-47302 – GridWeb shows partial comments in the cells 
CELLSNET-47303 – Option to access active cell or selected cells from outside the GridWeb 
CELLSNET-47304 – Use of the GridWeb inside an UpdatePanel without using AJAX

For CELLSNET-47303, we don’t quite understand your requirements, “outside the grid in ASP.NET application”? Please explain your scenario bit more.

In serverside code, you already have the grid object, so like in your code, you can use grid.ActiveCell. You can also get it through client js code

Below are the the js functions:

// public functions
gridweb.isDataChanged = isDataChanged;
gridweb.updateData = updateData;
gridweb.validateAll = validateAll;
gridweb.submit = submit;
gridweb.getCellValue = getCellValue;
gridweb.setCellValue = setCellValue;
gridweb.getActiveRow = getActiveRow;
gridweb.getActiveColumn = getActiveColumn;
gridweb.setActiveCellBasic = setActiveCellBasic;
gridweb.setActiveCell = setActiveCell;
gridweb.tryInitSetActiveCell = tryInitSetActiveCell;
gridweb.setActiveCellNoadjust = setActiveCellNoadjust;
gridweb.getSelectedCells = getSelectedCells;
gridweb.resizeColumnToFit = resizeColumnToFit;
gridweb.getActiveCell = getActiveCell;
gridweb.setActiveCellByCell = setActiveCellByCell;
gridweb.getCell = getCell;
gridweb.getLocateCell = getLocateCell;
gridweb.getCellRow = getCellRow;
gridweb.recalculateCellRowNumberOnCurrentCell = recalculateCellRowNumberOnCurrentCell;
gridweb.recalculateCellColNumberOnCurrentCell = recalculateCellColNumberOnCurrentCell;
gridweb.getCellColumn = getCellColumn;
gridweb.getColumn = getColumn;
gridweb.getCellColumnName = getCellColumnName;
gridweb.getCellName = getCellName;
gridweb.getCellValueByCell = getCellValueByCell;
gridweb.setCellValueByCell = setCellValueByCell;
gridweb.print = print;
gridweb.getClientPageHeight = getClientPageHeight;
gridweb.setActiveTab = setActiveTab;

You can get gridweb instance by etc. like document.getElementById(“grid”)
check more in acwmain.js and let us know your feedback.

Hi, thanks for the reply.

But if you notice on the sample project, when I access grid.ActiveCell on the server side its value is always 0. Both ActiveCell and SelectedCells properties do not correspond to the actual selected cells.

I can only access the selected cells through the grid’s events, for example on the double click event or the OnCustomCommand.

For the requirement logged under Id:CELLSNET-47303 could you please give a try to the following sample code and share the feedback.

In aspx :

            <asp:Button ID="btnAccessValue" runat="server" Text="Access Active Cell" OnClick="btnAccessValue_Click" />
            <asp:Button ID="btnChangeValue" runat="server" Text="Change Active Cell" OnClick="btnChangeActive_Click" />
            <asp:Button ID="btnSetValue" runat="server" Text="Set Active Cell" OnClick="btnSetValue_Click" />

In aspx.cs:

        protected void btnAccessValue_Click(object sender, EventArgs e)
            txbValue.Text = grid.ActiveCell.Value.ToString();


        protected void btnSetValue_Click(object sender, EventArgs e)

        protected void btnChangeActive_Click(object sender, EventArgs e)
            grid.ActiveCell = grid.ActiveSheet.Cells[1, 1];



When I first use these buttons:

        <asp:Button ID="btnAccessValue" runat="server" Text="Access Active Cell" OnClick="btnAccessValue_Click" />
        <asp:Button ID="btnSetValue" runat="server" Text="Set Active Cell" OnClick="btnSetValue_Click" />           

It always assumes the first cell of the grid.
After I use the btnChangeValue it starts assuming the second cell of the second row.

So it seems to be assuming the last cell selected on server side.

We have observed the issue which you have mentioned and are analyzing it here. We will write back here once any update is ready to share.

Regarding the issue logged under id:CELLSNET-47304 please use the following directly as it automatically uses ajax call to update view.

<acw:GridWeb ID="grid" runat="server" EnableAJAX="true" >

There is no need to use updatepanel to trigger ajax call . The wrap of updatepanel will result to unexpected content response for GridWeb that GridWeb can not recognize.

As per our observation:
Normal ajax call back :[gridweb response] generates the call back contents as follows:

[gridweb response] |0|hiddenField|__EVENTTARGET||0|....

Notice that there is addtional header and tail info.

We don’t want to treate it in every normal case and just not wrapping updatepanel can avoid this situation. However you can use updatepanel for any other part in the page just except GridWeb control.

Hi, thanks.
I tried using EnableAJAX=“true” in the beginning of our upgrade. However there are a lot of issues with that mode in our context that I could not overcome without making its use pointless.

The GridWeb is on a very large page.
We use grid’s command buttons and double click event to open various popups whose content is not static and is determined on server side depending on the cell that is selected. I then use these popups to alter the grid’s content.

I could not find a way to do this with Ajax without having to force a postback on the page.
I also need to use ViewState instead of Session. That was not working.

I use DevExpress popups on this page. They work best if everything is correctly organized in UpdatePanels. Currently, in order to have the GridWeb outside an UpdatePanel I also have to have the popups that perform changes on it outside UpdatePanels.
I also have to deal with the time the grid takes to adjust formatting on every postback.

The code was just an example to show how to use it. You need to implement business logic yourself.
If you select another cell in ui and want to get the active cell in serverside, then you can use CellClickOnAjax event.

For client side ,you can use OnCellSelectedClientFunction. Please refer to our demo page for how to use it. (1.7 KB)

About EnableAJAX=“true”, we have recorded your feedback along with the ticket and will write back here soon to share our feedback.

If you find any issue for EnableAJAX=“true”, please create a simple project to show us your issue. We’ll help you to work out. Moreover, ViewState is also supported and all the functions shall work as same as before.

Please try our latest version/fix: Aspose.Cells GridWeb v20.4.3: (5.3 MB)

Your issue logged earlier as “CELLSNET-47302” should be fixed in it.

I had to clean the browser’s cache so the changes could take effect. But the comments show properly now. Thanks.

Good to know that your issue is sorted out by the suggested hot fix. Feel free to contact us at any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSNET-47303,CELLSNET-47302) have been fixed in Aspose.Cells for .NET v20.5. This message was posted using Bugs notification tool by Amjad_Sahi