473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1047

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mike | last post by:
Hi, Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject? Thanks Mike
2
by: ecoder | last post by:
Hi I'm looking for some help regarding copying, selected datagrid items from one dataset to another... and then bind the new dataset to a another datagrid. Hope hearing from you. --...
10
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1)...
3
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
0
by: oscar | last post by:
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...
1
by: Gidi | last post by:
Hi, I have dataGrid which at first it's empty. i have another dataGrid which contains checkbox column, what i want to do is, that everytime a checkbox is checked, my dataGrid will be filled with...
1
by: Dhruba Bandopadhyay | last post by:
I have a DataGrid which has checkbox columns. The data source is a run-time created data set that I store in a session so I can rebind it during postbacks. I don't have a database or xml file, etc....
1
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
0
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.