Free Support Forum - aspose.com

How to get edited grid web cell value and add it to my total field

Hi,

How to retrieve the edited grid web cell value and total it to my total field before submit it to server ?

I have checked all your samples but none of them tell me what 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 (you may add the following code snippet to your code):

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.