c1Flexgrid with Datasource to a Datatable and an added column of type bool with checkbox

174 views Asked by At

When I set the Flexgrid to the datatable and then I go to add the column everything works fine, but the checkbox in the added column is not editable, I also tried to add the column to the Datatable but the result is the same. The code I used to add the column is as follows:

 Flex.DataSource = dt;
 Flex.Cols.Add();
 int conta=Flex.Cols.Count;
 Flex.Cols[conta - 1].Caption = "Seleziona";
 Flex.Cols[conta - 1].DataType = typeof(bool);
 Flex.Cols[conta - 1].AllowEditing = true;
 Flex.SetCellCheck(conta - 1, 0, CheckEnum.Unchecked

I would like the checkbox to be editable so that I can only select the rows that interest me. I've been looking for examples on Grapecity but their documentation site is really bad. Of the examples I have it looks like I've done everything correctly but it's not working, so obviously I doing something wrong but I don't know what.

1

There are 1 answers

0
Ally On

It's possibly because the bound column in the underlying DataTable is read-only. Update the column in the data table before setting it as the DataSource for the grid.

dt.Columns[conta - 1].ReadOnly = false;