471,073 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 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 6516
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Erald Kulk | last post: by
reply views Thread by Ubi | last post: by
2 posts views Thread by James Goodman | last post: by
2 posts views Thread by nate axtell | last post: by
1 post views Thread by B.J. Raiford | last post: by
reply views Thread by Ryan Liu | last post: by
reply views Thread by Brett Romero | last post: by
reply views Thread by leo001 | 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.