Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS IntraWeb Component Pack Pro
TIWAdvWebGrid: How to read/write the state of a checkbox

You can use RowSelect(RowIndex), which returns a boolean value, to know if a row with a column of type ctCheckBox is checked or not.

Example:
TIWAdvWebGrid1.RowSelect[0] := true;  


The ctCheckBox method can only be used for a single column. When multiple checkbox columns are required you can use the ctDynCheckBox ColumnType instead of ctCheckBox. You can read/write the state of a ctDynCheckBox columntype by using IWAdvWebGrid.DynEdits[ColumnIndex,RowIndex]. A value of ‘0’ will display an unchecked checkbox and a value of ‘-1’ will display a checked checkbox.

Example:
//Set checkbox in column 0 and row 1 to checked:
TIWAdvWebGrid1.DynEdits[0, 1] := ''1'';

//Set checkbox in column 1 and row 2 to checked:
TIWAdvWebGrid1.DynEdits[1, 2] := ''1'';

//Set checkbox in column 1 and row 3 to unchecked:
TIWAdvWebGrid1.DynEdits[1, 2] := ''0'';

If you would like to use the ctDynCheckBox column type, please note that by design there is no server event attached to this column type. To update the ctDynCheckBox values you’ll need, for example, an external button with a click event assigned. From the click event you can retrieve the DynEdits values from the AdvWebgrid and update the database manually.