I have one RadGridView for WinForm UI.
I bind data dynamically using DataSource property and bind DataTable that is returned from database.
Before binding datasource, I add a GridViewCheckBoxColumn to the RadGridView (for selecting all rows).
following is the sample code:
If RadGridView1.MasterTemplate.Columns.GetColumnByFieldName("").Length = 0 Then
Dim checkBoxColumn As GridViewCheckBoxColumn = New GridViewCheckBoxColumn("")
checkBoxColumn.EnableHeaderCheckBox = True
checkBoxColumn.HeaderCheckBoxAlignment = ContentAlignment.MiddleCenter
checkBoxColumn.AllowFiltering = False
checkBoxColumn.CheckFilteredRows = False
checkBoxColumn.HeaderText = String.Empty
AddHandler RadGridView1.HeaderCellToggleStateChanged, AddressOf RadGridView1_HeaderCellToggleStateChanged
Later I bind the data table:
RadGridView1.DataSource = dataTable
Now, I have 2 problems:
1. Checking / Unchecking header check box, checks/unchecks checkboxes of current page only. I need to perform the operation for the whole grid.
2. I have got filters on. User can select filters on columns. Once filters are applied, records are displayed according to those filters (other records are hidden). Now, when checking the header check box, it only selects records that are part of current page. For example, if I am on first page and apply filter on one column, grid will hide all rows from the first page that do not match the filter and pull records from 2nd and 3rd pages that match the criteria and show on the first page. But if I select check box in the header, then only records from first page are selected, records that came from 2nd and 3rd page are not selected.