DevExpress in the third-party control Library of the. NET platform should be relatively well-known. This control library is currently used by our project.
Currently involved in a development, to achieve a simple function, that is, in the list area to provide a selection box, so that users can achieve multiple choices.
Looked at the DevExpress forum, said very simple, if the bounded column, then the Columnedit attribute on its value of a repositoryitemcheckedit can be assigned.
But I do as required to do, the choice box can appear, but the dead or alive can not achieve multiple selection. Find a number of data, try a number of methods, such as a virtual increase in the database acquisition of a column, select 1 as selected ..., such as Optionsselection.multiselect = True, all these, can not be changed to achieve multiple selection.
What's the final solution? The original is because we use Oracle, but Oracle does not have a bool type, so simply do not add the column in the SELECT statement, and select after the DataTable passed to the foreground, after the assignment to DataGridView, manually add a column, as follows:
Data. Columns.Add ("SELECTED", typeof (System.Boolean));
for (int i = 0; i < data. Rows.Count; i++)
{
Data. rows[i]["SELECTED"] = false;
}
This ensures that the type of the column is bool and that each column is initialized to unchecked.
If it is SQL Server or another database, the database itself supports the bool type, then the direct SELECT statement, no such trouble.
The Repositoryitemcheckedit in DevExpress