If you have a Gridview with the first column edited with an RepositoryItemCheckEdit and with the datasource an runtime created datatable.
What I want to obtain and I not succeeded yet is to count the rows from the datatable with check on the first column and put the result in a labelimmediatelly after user changes check state of repository.
but if you check/Uncheck checkbox RepositoryItemCheckEdit Event then your Count not match with Gridview Checkbox.if you use different event of Gridview . the solution of your problem is..
Private Sub repositoryItemCheckEdit1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) gridView1.PostEditor() CountChecked() End Sub
The PostEditor method posts the edited value to the underlying source. I’ve attached a sample demonstrating how it works. Please test it and let us know your result.
the CountChecked method as follows:
Private Sub CountChecked() Dim checkedCount As Integer = 0 Dim dt As DataTable = CType(gridControl1.DataSource, DataTable) For i As Integer = 0 To dt.Rows.Count - 1 If CBool(dt.Rows(i)("Check")) Then checkedCount += 1 End If Next i labelControl1.Text = "Checked: " & checkedCount.ToString() End Sub