471,318 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

dataset to datagrid with checkbox

i currently have a dataset with a built, code and description fields. the
built field is either a 1 or 0 and i would like it to display as a checkbox
in the datagrid. i can get the checkboxes to show up, but they are all
checked and the column has no data when i try to check that. i have seen a
lot of posts about doing this, but no matter what i do i endup getting the
same results. currently i have this:

DataGridTableStyle tableStyle = new DataGridTableStyle();

tableStyle.MappingName = "laborcodes";
tableStyle.AlternatingBackColor = Color.LightBlue;
tableStyle.SelectionBackColor = Color.Yellow;
tableStyle.SelectionForeColor = Color.Black;
tableStyle.RowHeadersVisible = false;
//tableStyle.DataGrid.Refresh();

//bom
DataGridBoolColumn bomCol = new DataGridBoolColumn();
bomCol.MappingName = "built";
bomCol.HeaderText = "BOM";
bomCol.Width = 50;
bomCol.TrueValue = 1;
bomCol.FalseValue = 0;
bomCol.NullValue = bomCol.FalseValue;
bomCol.ReadOnly = false;
tableStyle.GridColumnStyles.Add(bomCol);

//code
DataGridTextBoxColumn codeCol = new DataGridTextBoxColumn();
codeCol.MappingName = "code";
codeCol.HeaderText = "Code";
codeCol.Width = 80;
tableStyle.GridColumnStyles.Add(codeCol);

//description
DataGridTextBoxColumn desCol = new DataGridTextBoxColumn();
desCol.MappingName = "description";
desCol.HeaderText = "Description";
desCol.Width = 150;
tableStyle.GridColumnStyles.Add(desCol);

dgdLC.TableStyles.Add(tableStyle);

this is for a windows form and the user will not be able to directly change
the checkbox. it just does not show up correctly and i know that my dataset
has the right data in it, because when i change the built column to a text
column it displays the 1's and 0's. what's a simple way to get the 1's and
0's to appear as checkboxes?

thanx in advance.
Jul 21 '05 #1
0 990

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mike | last post: by
3 posts views Thread by Datatable Dataset Datagrid help | last post: by
reply views Thread by oscar | last post: by
1 post views Thread by Gidi | last post: by
1 post views Thread by Dhruba Bandopadhyay | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.