Using a Common Button to Submit Grid Data

The example that you use for VB.NET does not seem to work for me. If I cut and paste the code I get errors. It appears that you are trying to concatenate in the form of C#.

I modified the code to work for VB.net, but as I step through the code and watch grdMain.ModifiedCells. If I click the grid's Add icon it shows the number of changes that I made. If I click my "continue" button, it shows 0 modifications.

Could you please assist me with this?

http://www.aspose.com/documentation/visual-components/aspose.grid-for-.net/using-a-common-button-to-submit-grid-data.html

Thanks,

rwebb2

Hi,

Well, I don't find any problem with it, it just works fine.

Following is my sample code. I just created a new Asp.Net (VB) project, added the GridWeb to its Default.aspx page, place an Asp.NET command button named "SubmitButton".

I run the page, I put some data into some cells i.e.., A5, C4, D4,C5,D5 etc. Now, when I click the SubmitButton, I can get the number of modifications (count of cells) and the A5 value is just copied to A1 cell.

Sample code (.vb source file):

Imports Aspose.Grid.Web
Imports Aspose.Grid.Web.Data

Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Checking if there is no postback

If Not IsPostBack Then

'Adding javascript function to onclick attribute of Button control

SubmitButton.Attributes("onclick") = GridWeb1.ClientID + ".updateData(); if (" + GridWeb1.ClientID + ".validateAll()) return true; else return false;"

End If


End Sub

Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitButton.Click
Dim list As ArrayList = GridWeb1.ModifiedCells
GridWeb1.WebWorksheets(0).Cells("A2").PutValue(list.Count.ToString())

GridWeb1.WebWorksheets(0).Cells("A1").PutValue(GridWeb1.WebWorksheets(0).Cells("A5").StringValue)
End Sub
End Class

If you get different results, kindly do create a sample test project and post it here, we will check it soon. Also, always try the latest version (2.0.0.2001).

Thank you.

Amjad,

I had some typos. I plugged in what you had and changed the names to protect the innocent. It works!!

Thanks!

rwebb2