I am using a GridDataBoundGrid. I have a bool column. I made the celltype of the bound column as "CheckBox". Instead of displaying a button, I want to display a checkbox in the header cell. When ever the user checks/unchecks the header checkbox, I want to toggle all checkboxes in the column.
I tried setting
gridDataBoundGrid1[0, 1].CellType = "CheckBox";
But I am still getting a header button instead of checkbox. What am I doing wrong?
ADAdministrator Syncfusion Team January 17, 2003 06:07 PM
In a GridDataBoundGrid, you cannot use an indexer to set individual cell style properties (other than Text). The reason is that there is no data object allocated to save these properties. The only cell data is the data from your DataSource (this is why you can set the Text property as it is mapped to the data in your datasource, but you cannot set other cell properties.)
So, to do something like this, you can use the Model.QueryCellInfo to set these properties, and then handle the grid's click event to toggle the setting. Attached is a rough try at this.
ADAdministrator Syncfusion Team January 20, 2003 09:40 AM
Thank you very much for your help.
There is one problem with the sample. When I double click on the checkbox header, it is sorting the column. After that, when I try to click on header checkbox, it is not working properly. It is sorting the column dynamically.
SortBehaviour is for the whole grid.
Can I disable sorting for just one column?
ADAdministrator Syncfusion Team January 20, 2003 02:10 PM
If you derive the GridDataBoundGrid, you can override OnCellDoubleClick and avoid the sort at that point.