473,372 Members | 1,301 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,372 software developers and data experts.

DataGridBoolColumn

Ubi
Hi,
my code is:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));
DataGridBoolColumn cs1 = new DataGridBoolColumn();
cs1.NullValue=false;
cs1.TrueValue=true;
cs1.FalseValue=false;
cs1.MappingName="checked";
cs1.ReadOnly=false;
dataGrid1.TableStyles[0].GridColumnStyles.Add(cs1);
what i get is always a gray checkbox. When i click it, it becomes checked,
and another click turns it into grey, and then unchecked act...
I want:
a. default value is uncheked
b. only to states - checked/unchecked (no gray)

what should i do... please help..
Nov 16 '05 #1
4 6667
Ubi,

First, you should change the following line:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));

To:

myDataTBL.Columns.Add("checked", typeof(bool));

Then, on the DataGridBoolColumn that you create (cs), set the AllowNull
property to false.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ubi" <Ub*@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
Hi,
my code is:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));
DataGridBoolColumn cs1 = new DataGridBoolColumn();
cs1.NullValue=false;
cs1.TrueValue=true;
cs1.FalseValue=false;
cs1.MappingName="checked";
cs1.ReadOnly=false;
dataGrid1.TableStyles[0].GridColumnStyles.Add(cs1);
what i get is always a gray checkbox. When i click it, it becomes checked,
and another click turns it into grey, and then unchecked act...
I want:
a. default value is uncheked
b. only to states - checked/unchecked (no gray)

what should i do... please help..

Nov 16 '05 #2
Ubi,

First, you should change the following line:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));

To:

myDataTBL.Columns.Add("checked", typeof(bool));

Then, on the DataGridBoolColumn that you create (cs), set the AllowNull
property to false.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ubi" <Ub*@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
Hi,
my code is:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));
DataGridBoolColumn cs1 = new DataGridBoolColumn();
cs1.NullValue=false;
cs1.TrueValue=true;
cs1.FalseValue=false;
cs1.MappingName="checked";
cs1.ReadOnly=false;
dataGrid1.TableStyles[0].GridColumnStyles.Add(cs1);
what i get is always a gray checkbox. When i click it, it becomes checked,
and another click turns it into grey, and then unchecked act...
I want:
a. default value is uncheked
b. only to states - checked/unchecked (no gray)

what should i do... please help..

Nov 16 '05 #3
Ubi
This is working, except the starting value is grey.
after i click it the first time i don't get gray check anymore...
but how can i change the starting value to unchecked?


"Nicholas Paldino [.NET/C# MVP]" wrote:
Ubi,

First, you should change the following line:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));

To:

myDataTBL.Columns.Add("checked", typeof(bool));

Then, on the DataGridBoolColumn that you create (cs), set the AllowNull
property to false.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ubi" <Ub*@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
Hi,
my code is:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));
DataGridBoolColumn cs1 = new DataGridBoolColumn();
cs1.NullValue=false;
cs1.TrueValue=true;
cs1.FalseValue=false;
cs1.MappingName="checked";
cs1.ReadOnly=false;
dataGrid1.TableStyles[0].GridColumnStyles.Add(cs1);
what i get is always a gray checkbox. When i click it, it becomes checked,
and another click turns it into grey, and then unchecked act...
I want:
a. default value is uncheked
b. only to states - checked/unchecked (no gray)

what should i do... please help..


Nov 16 '05 #4
You have to set the value to false. Basically True = checked, False =
unchecked, Null = 3rd State/Gray

"Ubi" <Ub*@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.com...
This is working, except the starting value is grey.
after i click it the first time i don't get gray check anymore...
but how can i change the starting value to unchecked?


"Nicholas Paldino [.NET/C# MVP]" wrote:
Ubi,

First, you should change the following line:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean"));

To:

myDataTBL.Columns.Add("checked", typeof(bool));

Then, on the DataGridBoolColumn that you create (cs), set the AllowNull property to false.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ubi" <Ub*@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
Hi,
my code is:

myDataTBL.Columns.Add("checked",System.Type.GetTyp e("System.Boolean")); DataGridBoolColumn cs1 = new DataGridBoolColumn();
cs1.NullValue=false;
cs1.TrueValue=true;
cs1.FalseValue=false;
cs1.MappingName="checked";
cs1.ReadOnly=false;
dataGrid1.TableStyles[0].GridColumnStyles.Add(cs1);
what i get is always a gray checkbox. When i click it, it becomes checked, and another click turns it into grey, and then unchecked act...
I want:
a. default value is uncheked
b. only to states - checked/unchecked (no gray)

what should i do... please help..


Nov 16 '05 #5

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

Similar topics

1
by: Erald Kulk | last post by:
I have a problem with a datagridboolcolumn that drives me almost crazy. I have a sql server table with several columns of which one is a column called ok which is a bit with default value 0. In...
2
by: PeterZ | last post by:
Hi, In the past I've successfully databound a conventional Winforms checkbox to a number column in an Oracle table, where 1 represents true and 0 represents false. The checkbox would be ticked...
0
by: Ubi | last post by:
Hi, my code is: myDataTBL.Columns.Add("checked",System.Type.GetType("System.Boolean")); DataGridBoolColumn cs1 = new DataGridBoolColumn(); cs1.NullValue=false; cs1.TrueValue=true;...
2
by: James Goodman | last post by:
I have a number of bool columns within a datagrid, but they dont work as expected. The underlying table is Access 2000. The datatype for the underlying fields is Yes/No. I am attempting to...
1
by: Edward Koucherian | last post by:
I'm getting the incorrect display value on my DataGrid column. The field is numeric (1) in the SQL database table The Code is txtCol = New DataGridBoolColumn txtCol.MappingName = "MyCol"...
2
by: nate axtell | last post by:
I'm trying to create a custom DataGridBoolColumn. I inherit DataGridColumnStyle and create a public CheckBox variable. This columnType will be mapped to a dataTable boolean column. What are the...
1
by: B.J. Raiford | last post by:
I have a DataGrid on a form in my application that is bound to an xml file and I have set the table style to contain a few columns with one editable one, a DataGridBoolColumn. I set...
0
by: Ryan Liu | last post by:
Hi, I have a strange problem, should be very simple, take me days I couldn't finger out. Really appreciate if you can help me fine the problem. I am trying to use DataGridBoolColumn, but I...
0
by: Brett Romero | last post by:
I've created a DataGrid DataGridBoolColumn column in a tablestyle and mapped it correctly to a datatable. Problem is the column is always grayed and I can't uncheck it. I have the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.