Free Support Forum - aspose.com

Aspose.Web.Grid SelectCells Problem

Hi,

I am using aspose.web.grid with ASP.NET (VB language). I am having problem working around with Selectcells. Can you provide me an example of how to get this cell collection with VB style coding in ASP.NET.

Thanks

Ankit

Hi,

I wrote a sample:

Private Sub GridWeb1_SubmitCommand(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridWeb1.SubmitCommand
'Gets the selected cells
Dim selectCells As ArrayList = GridWeb1.SelectCells
If Not (selectCells Is Nothing) Then

Dim list As ArrayList
For Each list In selectCells
Dim cell As WebCell
' Each list represents a row of cells.
For Each cell In list

cell.PutValue("ok")
Next
Next

End If

End Sub

Hi,

Thanks for quick reply. This code reply works for me. Now i have one more problem. Actually i want to call

Private Sub GridWeb1_SubmitCommand(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridWeb1.SubmitCommand
.........

End sub

from another button event like below.

Private Sub BtnGet_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGet.ServerClick

call GridWeb1_SubmitCommand(sender,e)

end sub

But it is not working. Can you help me in this.

Regards

Ankit

If you are using other buttons on the page to postback data, you need to do something with your buttons to let it update the Grid’s data and validate the input data before it post back. It’s very simple. For example:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
Button1.Attributes("onclick") = "GridWeb1.updateData(); if (!GridWeb1.validateAll()) return false;"
End If
End Sub

You may read these two articles to get more information about the client-side scripting:

http://www.aspose.com/Wiki/default.aspx/Aspose.Grid/UsingCommonButton.html

http://www.aspose.com/Wiki/default.aspx/Aspose.Grid/ClientSideScripting.html

I wish this helps.

Thank you.

Hi,

Thanks. I was able to solve all of my problems. Thanks for instant help.

Regards

Ankit