Current filter:
                                You should refresh the page.
                                  • Hello !
                                    Please help me with this (simple I think) problem:
                                    I 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 label immediatelly after user changes check state of repository.

                                    I'm using successfully FocusedRowChanged event but I want to obtain this result even I click in the same row of the changed check, or even after I just click on the RepositoryItemCheckEdit, without another click on another cell.
                                    How could I obtain this result ?
                                    Thank you very much !

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,
                                I suggest you remove the FocusedRowChanged event handler and handle the RepositoryItemCheckEdit.CheckedChanged event in the following manner:

                                [VB.NET]
                                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.

                                • Valentin Badea 04.01.2014

                                  Yes, thank you for your response and sample ! Your sample works as I expected for, but I want to count rows in datatable, not in the gridview since the datatable is used for further calculations. Anyway, is enough good for me.
                                  Thank you !

                                • Valentin Badea 04.01.2014

                                  I want to use the datatable to count because the grid is sometimes filtered and I want to count in both visibile and invisible rows...

                                • Andrew Ser (DevExpress Support) 04.01.2014

                                  Hi,
                                  Change the CountChecked method as follows:

                                  [VB.NET]
                                  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

                                  Feel free to contact us if you need any further assistance.

                                • Valentin Badea 04.01.2014

                                  Yes, this works ! Thank you very much !

                                • Andrew Ser (DevExpress Support) 04.01.2014

                                  Hi,
                                  I am happy to hear that the issue is solved. Thank you for keeping us informed. Please feel free to contact us if you need any additional assistance.