C# DataSet CheckBox Column With DevExpress DataGrid

Posted by Goober on Stack Overflow See other posts from Stack Overflow or by Goober
Published on 2010-03-11T09:33:07Z Indexed on 2010/03/14 12:05 UTC
Read the original article Hit count: 1264

Filed under:
|
|
|
|

Scenario

I have a DevExpress DataGrid which is bound to a DataSet in C#. I want to populate each dataset row to contain a string in the first column and a checkbox in the second. My code below doesn't work quite how I want it to, and I'm not sure why.....

The Code

As you can see I've declared a dataset, but when I try and pass in a new checkbox object to the 2nd column it just displays the system name for the checkbox.

        DataSet prodTypeDS = new Dataset();
        DataTable prodTypeDT = prodTypeDS.Tables.Add();
        prodTypeDT.Columns.Add("MurexID", typeof(string));
        prodTypeDT.Columns.Add("Haganise",typeof(CheckBox));

        //WHY DOES THIS NOT WORK? 
        //(Displays "System.Windows.Forms.CheckBox, CheckState: 0")
        //Instead of a checkbox.
        CheckBox c = new CheckBox();
        prodTypeDS.Tables[0].Rows.Add("Test",c);
        //This doesn't work either....
        prodTypeDS.Tables[0].Rows.Add("Test",c.CheckState);

......I hope this is just because it's a DevExpress datagrid....

© Stack Overflow or respective owner

Related posts about c#

Related posts about checkbox