Add a checkbox column to the briskdatagrid
After a checkbox column is added to the briskdatagrid, each cell in the column is displayed as a checkbox. To add a datagridcheckboxcolumn like a briskdatagrid, you must first declare a datagridcheckboxcolumn object. Then, use the addcheckboxcolumn () method of the briskdatagrid to add the object to the briskdatagrid. The following is a prototype of the addcheckboxcolumn () method:
Public sub addcheckboxcolumn (_
Byval checkboxcolumn as datagridcheckboxcolumn ,_
Byval mappingname as string ,_
Optional byval headertext as string = "",_
Optional byval [readonly] as Boolean = false ,_
Optional byval width as integer = 75 ,_
Optional byval allownull as Boolean = false ,_
Optional byval truevalue as object = true ,_
Optional byval falsevalue as object = false)
Checkboxcolumn |
This parameter requires a datagridcheckboxcolumn object, which is the checkbox column to be added to the briskdatagrid. |
Mappingname |
This parameter accepts a string. The name of the data member mapped to the checkbox column. |
Headertext |
This parameter accepts a string. This string is used to set the text of the column header. This parameter is an optional parameter. The default value is "". |
Readonly |
This parameter accepts a Boolean value. This value determines whether the column is read-only. True, read-only; false, not read-only. This parameter is an optional parameter. The default value is false. |
Width |
This parameter accepts an integer to determine the column width. Optional. The default value is 75. |
Allownull |
This parameter accepts a Boolean value to determine whether the column can accept null values. True: NULL values can be accepted. False: NULL values cannot be accepted. This parameter is an optional parameter. The default value is false. |
Truevalue |
This parameter accepts an object to determine the actual value used when the column value is set to true. This parameter is an optional parameter. The default value is true. |
Falsevalue |
This parameter accepts an object to determine the actual value used when the column value is set to false. This parameter is an optional parameter. The default value is false. |
The following program snippet shows how to add a checkbox column to the briskdatagrid:
Private sub initbriskdatagrid ()
Dim dvemployee as new dataview (Me. dshr. Tables ("employees "))
Me. briskdatagrid. setdatabinding (dvemployee)
Me. briskdatagrid. begintablestyle ("employees ")
Dim colsingle as new datagridcheckboxcolumn
Me. briskdatagrid. addcheckboxcolumn (colsingle, "emp_single", "single ")
Me. briskdatagrid. endtablestyle ()
End sub