Free Support Forum - aspose.com

How to get the edited grid web cell value and put it to my own total field?

Hi

May I now how to retrived the edited grid web cell value and add these values to a total lebel field before submit the worksheet to server ?

I have checked all the samples provided but none of them tell me how to do. Thank You.


This message was posted using Page2Forum (attachment) from edited cell string - Aspose Search Results - Aspose.com

Hi,

Well, on the server side, you may handle SheetDataUpdated event, e.g
Protected Sub GridWeb1_SheetDataUpdated(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridWeb1.SheetDataUpdated
Dim sheets As WebWorksheets = GridWeb1.WebWorksheets
Dim sheet As WebWorksheet = sheets.ActiveSheet
Dim cells As WebCells = GridWeb1.WebWorksheets(0).Cells
Dim cell As WebCell
Dim tot As Double = 0
Dim value As Double = 0
For v1 As Integer = 0 To 3
value = cells(v1, 3).Value
tot += value
Next v1

Label2.Text = tot.ToString()
End Sub

(Note: you need to post the data to server to fire the above event, e.g you may click submit button)

On the client side you may use onCellUpdated client event or other suitable event to get the updated cell value for your need. You may use GridWeb’s getCellValueByCell() method.


E.g

Default.aspx



Untitled Page






 <acw:GridWeb ID=“GridWeb1” runat=“server” OnCellUpdatedClientFunction=“onCellUpdated”>
</acw:GridWeb>

<asp:Label ID=“Label1” runat=“server” Text=" Total Unit :" Width=“263px”></asp:Label>
<asp:Label ID=“Label2” runat=“server” Width=“174px”></asp:Label>

 





For further reference, please see the Scripting demos e.g you may check the ClientSideEvents.aspx and ClientSideFunctions.aspx demo pages in the gridweb’s featured demo solutions.


Thank you.