Hi, i was using a grid with a CheckBox in the header. Now i want to group the items and i was succeed in it also. When i checked the CheckBox in the header of the particular group, all the items of that group are also checked. It seems very good for me.
But when i checked the CheckBox as i marked with red circle in the attachment, i want all the items to be checked, which i was able to achieve before grouping the items.
Hello.
By default, the synchronization resolves to work on a RowsCollection basis. As such, checking the checkbox on the header for the FilterRow will not affect any of the datarows.
You can specify the synchronization to work on a Band level (i.e affect all the UltraGridRows within the UltraGridBand) by changing the HeaderCheckBoxSynchronization property to Band. This can by done on either the column or the band level as this property is exposed on both the Column's Header and the Band's Override.
If you require further assistance, feel free to ask.
Thanks,
Chris
Hi Chris
Thank you for your quick response.
I change the HeaderCheckBoxSynchronization property to Band, in this case even if i checked in the header of GroupRow all the items are checked. I tried with all four properties of HeaderCheckBoxSynchronization but no luck.
What i basically looking for is as:
IF i check on the CheckBox in Red mark, i want all the items to be checked. and if i check the CheckBox in yellow mark, i want items of its child bands only to be checked, in this case, for example if i check the checkbox under yellow mark only two items to be checked and rest should be in its usual condition.
Is there any property i am missing.
Thank you
Bishwa
Hello Bishwa,
The functionality you are trying to achieve can be handled with a little bit of code in the UltraGrid's BeforeHeaderCheckStateChanged event handler, by calling SetHeaderCheckedState() on child RowsCollections for each row in e.Rows if it is a UltraGridGroupByRow. With the HeaderCheckBoxSynchronization set to RowsCollection, use the following code:
private void ultraGrid1_BeforeHeaderCheckStateChanged(object sender, BeforeHeaderCheckStateChangedEventArgs e) { // If the rows in the Rows collection are GroupByRows, // then call SetHeaderCheckedState on the child RowsCollection // Check IsCancelable to make sure we are only doing this when the Header CheckBox is clicked, not during synchronization. if (e.IsCancelable && e.NewCheckState != CheckState.Indeterminate && e.Rows != null && e.Rows.Count > 0 && e.Rows[0].IsGroupByRow) { int numRows = e.Rows.Count; for (int i = 0; i < numRows; i++) { UltraGridGroupByRow groupByRow = e.Rows[i] as UltraGridGroupByRow; e.Column.SetHeaderCheckedState(groupByRow.Rows, e.NewCheckState); } } }
This will hopefully meet your needs. Let me know if you require further assistance.
Hai Chris,
I am using Infragistics 2010. In my grid, i am using header checkbox for a checkbox column. When i select or de-select the header checkbox, all the value in the column get changed.
My Problem is If i tried to deselect the checkbox in the row, the header checkbox changed to Tri-State. Even after i deselected all rows, the tri-state of header is not changed. I need your guideance.
Can you post a small sample project demonstrating this behavior? I tried it out and it works correctly for me.
My guess is that there is some other factor at work here, like something in your code that is causing the header checkbox to get out of synch.
Hai Mike,
I attached the sample project with this. Please guide me.
What version are you using? This may be a bug that was fixed. Try getting the latest Service release and see if that helps.
How to get the latest service release - Infragistics Community
Hi Mike,
I followed your code and its working fine.. but the problem i am facing is when i check the header to true , all the rows are checked and vice versa.. but once i check the header true and manually uncheck any of the rows, it wont change the header to uncheck,
Thanks Mike. My Problem solved.
Hi Suresh,
The problem is that your unbound column in this sample never has it's DataType set, so it's defaulting to string. In order for the header checkbox to work properly, the column needs to be a boolean.
Just set the column's DataType to Boolean and it works fine.