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

Free Support Forum - aspose.com

GridWeb - behavior or select cell and save value

Hi, we are using GridWeb to update values and submit to server. We have run into a few things that make it hard to work with.

a. select cell - when you select a cell users want to act like excel in that it overwrites values. Is there an easy way to set it up to select text when a user enters a cell?

b. When we submit the form, it seems we loose any value in a currently editing cell - the user needs to first tab out of the cell. Is there anything we can do to force a saved value if the user clicks on a button outside the control to submit the page?



Thanks for your query.

Aspose.Cells.GridWeb tries to mimics the MS Excel behavior for certain operations and features but being a web control (there are certain challenges and other hindrance involved on web scenario), so, you might not work more seamlessly and fluently as you do in desktop MS Excel application.

a) Well, it is by design. If a cell is selected or focused is set on a cell, now when you start writing, it would append the text to it at the start (by default). If you need to overwrite the existing contents, you got to double click in it, so you could overwrite the existing text.

b) You may try to use GridWeb.SaveToExcelFile() method (you may use the code in your Asp.NET button’s click event) to export the GridWeb’s data/contents to an Excel file for your requiredment.

Thank you.

Thanks for quick reply. Couple comments.

a. the default behavior of Excel is overwrite contents, not append. So this is what is bothering users.

b. I was hoping you can tell me JS function or something that will commit the value in the cell as if the user tabbed out of the control. We should not have to export it to get the value. We just need to trigger the lost focus or whatever the current event is that does this.



a) Well, as I said, this behavior (of Aspose.Cells.GridWeb) is by design and you have to use it by following the instructions as per my previous comments. I will still check with the concerned developer from product team if we could enhance it or not.

b) I think you can use OnCellUpdatedClientFunction to record updated cells.
See the example below for an .aspx file’s source:
Sample code:

<acw:GridWeb ID=“GridWeb1” runat=“server” Width=“100%” Height=“100%” OnCellUpdatedClientFunction=“clientupdate”></acw:GridWeb>

Also, see the document on client side scripting/functions:

Hope, this helps a bit.

Thank you.