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

Free Support Forum - aspose.com

How to call JS Function

I have updated the .dll with version 17.8.0.
I did as explained above and the comment does not add up on my cell.

<acw:GridWeb ID="GridWeb1" runat="server" ShowLoading="true" PresetStyle="Standard"
     RenderHiddenRow="false" AutoFitColumn="true OnCellUpdatedClientFunction="onCellUpdated"
     XhtmlMode="true" Width="100%" Height="100%" OnCellModifiedOnAjax="GridWeb1_CellModifiedOnAjax"
     OnCellSelectedClientFunction="getContextForCell" EnableAsync="true"
     ShowUndoButton="false"howTabNavigation="false" ShowSaveButton="false" ShowSubmitButton="false"
     ShowLoadingPosition="true" OnCellClickOnAjax="WorksheetCellClickOnAjax" 
     OnCellSelectedAjaxCallBackClientFunction="OnCellSelectCallBack" EnableAJAX="true"> 
</acw:GridWeb>


 function onCellUpdated(cell) {
          var col = this.getCellColumn(cell);
          var row = this.getCellRow(cell);

         console.log("cell updated " + " row:" + row + " ,col:" + col + " ," + this.getCellName(cell));

         var cmnt = cell.getAttribute('CMNT');
         console.log("cmnt " + cmnt );
         if (cmnt != null) {
              ShowModalError("error", cmnt);
        }
  }

    protected void GridWeb1_CellModifiedOnAjax(object sender, CellEventArgs e)
    {
         GridWorksheet sheet = GridWeb1.WorkSheets[worksheetState.ReportWorksheet.Name];
         int i = sheet.Comments.Add(e.Cell.Name);
         GridComment comment = sheet.Comments[i];
         comment.Note = "Test Add " + e.Cell.Name;
   }

@lswe,

Please make sure you are using latest version of Aspose.Cells.GridWeb v17.8 with its resource files (in “\acw_client” folder @ your installation directory). Moreover, please refer to the code segment shared here:

If you still find the issue, kindly do create a sample project with Aspose.Cells.GridWeb v17.8, zip it and post us to reproduce the issue on our end, we will check it soon. Moreover, you may use any third party file sharing service (e.g dropbox, Google drive, etc.) to upload your sample project and share the Download link here.

Please can you give me the link for download the latest version of Aspose.Cells.GridWeb v17.8 with its resource files
Thank you

@lswe,

Please install Aspose.Cells for .NET v17.8 package using its MSI installer:
Aspose.Cells for .NET (Download | NuGet)

Now you will find Aspose.Cells.GridWeb v17.8 Dll with its resource files @ your installation directory.

I use the latest version of aspose.
And i cannot add a comment on my cell.
I have create a sample of our project.
You can download it on the link below :
https://1drv.ms/u/s!AvyGA5WCRAkDglJHNPTf3mXTmYkW
Thank you for you help

@lswe,

Thanks for the sample project.

I have run your project with Aspose.Cells.GridWeb v17.8, it works fine and adds the comment to to the first worksheet cell in the workbook, see the screenshot attached for your reference:
scshot_comments1.png (22.6 KB)

Ok the comment is add to the cell but i cannot get it in the cellupdated(cell) js method

function cellupdated(cell) {
        var col = this.getCellColumn(cell);
        var row = this.getCellRow(cell);

        console.log("cell updated " + " row:" + row + " ,col:" + col + " ," + this.getCellName(cell));
       
        var comment = cell.getAttribute('CMNT');
        if (comment != null) {
            console.log("client side here:cell with comment :" + comment + ",author:" + cell.getAttribute('CMNT_AUTHOR'));

        }
    }

@lswe,

You are right. I am able to observe the issue as you mentioned by using his sample code in the project. I found that comment is added to the cell on server side, but it is not retrieved on client side (Javascript). I checked the variable (for comment) which is always null.
e.g
Sample code:

........ 
<script type="text/javascript"> 

        function cellupdated(cell) { 
            var col = this.getCellColumn(cell); 
            var row = this.getCellRow(cell); 

            console.log("cell updated " + " row:" + row + " ,col:" + col + " ," + this.getCellName(cell)); 
            
            var cmnt = cell.getAttribute('CMNT'); 
            console.log("cmnt " + cmnt); 

           } 

    </script>
....... 

I have logged a ticket with an id “CELLSNET-45654” for your issue. We will look into soon.

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

@lswe,

We did evaluate your issue further and found there was a mistake in the shared details (by us). Now we have extended GridComment. Basically, we have those attributes in the cell’s HTML node already:

  • CMNT_NOTE the basic comment note;

  • CMNT_AUTHOR the comment author;

  • CMNT_VISIBLE the visible of the comment

  • CMNT_W the width of the comment

  • CMNT_H the height of the comment
    so, you can use cell.getAttribute(‘CMNT_NOTE’) for your needs. See the updated code segment that works fine as I tested:
    e.g
    Sample code:

          function cellupdated(cell) { 
              var col = this.getCellColumn(cell); 
              var row = this.getCellRow(cell); 
    
              console.log("cell updated " + " row:" + row + " ,col:" + col + " ," + this.getCellName(cell)); 
              
              var cmnt = cell.getAttribute('CMNT_NOTE'); 
              console.log("cmnt " + cmnt); 
    
             } 
    
      </script>
    

Hope, this helps a bit.

The rest of the code (server side) don’t need to be change ?
I declare my GridComment like this ?

GridWorksheet sheet = GridWeb1.WorkSheets[0];
int i = sheet.Comments.Add(e.Cell.Name);
GridComment comment = sheet.Comments[i];
comment.Note = errorMessage + " " + e.Cell.Name;

Please don’t take attention to my last comment.
I had one problem on my code.
It’s alright adding comment and get it on my js function work fine.
Now can i delete that comment in the js function ?

@lswe,

I will check if the feature (deleting comments from the cells on client side (JavaScript)) is already supported. If so, we will provide you the sample code segment for your reference. If not, we will support it soon. I have logged a ticket with an id “CELLSNET-45659” for your issue/requirements. We will look into it soon.

Thank you.

@lswe.

We have supported the feature (logged earlier as “CELLSNET-45659” - delete comments on the cells on client side). We will provide you the fix after performing QA and incorporating other enhancements and fixes.

In the upcoming fix, we add client Javscript API: delcomment(row,col) for your needs:
e.g
Sample code:

//assume  gridwebinstance is the html control of the GridWeb
gridwebinstance.delcomment(1,2);

Moreover, we have added right mouse context menu for deleting comments through user operation.
First you can select the cells with comment, multiple selection with Ctrl is also allowed, then in the context menu, choose delete comments.

Do you have any idea when the update will be available?
Thank you

@lswe,

The next fix would be available in the next few days (2-5 days). Once published, we will share the Download link here.

Keep in touch.

@lswe,

Please try our latest version/fix: Aspose.Cells.GridWeb v17.9.2

Your issue “CELLSNET-45659” should be fixed in it.

Let us know your feedback.

Thanks, I can add a comment in the server-side.
And I can handle it JS side

@lswe,

Thanks for your feedback.

Good to know that it works for your needs. Feel free to contact us 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-45654) have been fixed in Aspose.Cells for .NET 17.10.

Hi,

It seems that the delcomment function does not work.

Here is my code :

               function onCellUpdated(cell) {
                var errorMessage = cell.getAttribute('CMNT_NOTE');
                if (errorMessage != null) {
                    ShowModalError("error", errorMessage);

                    var col = this.getCellColumn(cell);
                    var row = this.getCellRow(cell);

                    var gw = gridwebinstance.get("<%=GridWeb1.ClientID%>");
                    gw.delcomment(row, col)
                }

            } 

I have no JS error but when i’m inspecting the html element, all the CMNT_* are still here :

<td title="" align="right" class="GridWeb1_8" id="GridWeb1_7#20" valign="bottom" style="color: rgb(0, 0, 0); background-color: transparent;" needvalidateforlistitems="1" CMNT_NOTE="La date d'application doit être supérieure à la date d'application de la dernière saisie" CMNT_AUTHOR="TEST$" CMNT_VISIBLE="0" CMNT_HTML="&amp;amp;#60;Font Style=&amp;quot;FONT-WEIGHT: bold;FONT-FAMILY: Tahoma;FONT-SIZE: 8pt;COLOR: #000000;TEXT-ALIGN: left;&amp;quot;&amp;amp;#62;La date d&amp;#39;application doit &amp;#234;tre sup&amp;#233;rieure &amp;#224; la date d&amp;#39;application de la derni&amp;#232;re saisie&amp;amp;#60;/Font&amp;amp;#62;" CMNT_W="128" CMNT_H="74"><span class="acwxc" style="height: 13.66px; color: rgb(0, 0, 0); vertical-align: bottom; display: block; -ms-word-break: keep-all; horizontal-align: Right;">100</span></td>

Thanks,