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

Datagrid - Windows - DataGridBoolColumn - How can I disable all the check boxes in the column

I tried boolCol.ReadOnly = true and a bunch of other things but can't get
the check boxes for the datagrid's column for all rows to be disabled? Can
someone tell me how to do this?

MyGrid.ReadOnly = true;

MyGrid.Click += new EventHandler(MyGrid_Click);

MyGrid.CaptionVisible = false;

tableStyle = new DataGridTableStyle();

tableStyle.MappingName = "MyItemsData";

tableStyle.AllowSorting = false;

tableStyle.RowHeadersVisible = false;

//MyCheckBox Check

boolCol = new DataGridBoolColumn();

boolCol.MappingName = "MyCheckBox";

boolCol.HeaderText = "MyCheckBox";

boolCol.AllowNull = true;

boolCol.NullValue = string.Empty;

boolCol.FalseValue = false;

boolCol.TrueValue = true;

boolCol.Width = boolColWidth;

tableStyle.GridColumnStyles.Add(boolCol);

boolCol = null;
Nov 21 '05 #1
3 1125
Richard,

From your code I get the idea that you are using a windowforms datagrid,
but when I see the newsgroups you are posting to, than you bring me in
doubt.

Therefore a short answer. For a windowsform datagrid is the bool column only
representing the status in the underlying datasource. Therefore you need to
set the underlying datasource to the values you want.

I hope this helps,

Cor
Nov 21 '05 #2
Yes, it is bound to a DataTable. I had a feeling that it would have to be a
manual process of going through the datatable and setting the booleans to
whatever. I did not realize I was posting to the aspnet group.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Richard,

From your code I get the idea that you are using a windowforms datagrid,
but when I see the newsgroups you are posting to, than you bring me in
doubt.

Therefore a short answer. For a windowsform datagrid is the bool column only representing the status in the underlying datasource. Therefore you need to set the underlying datasource to the values you want.

I hope this helps,

Cor

Nov 21 '05 #3
Richard,

Maybe does this sample that I just made do what you want.

\\\\
Dim dt As New DataTable
dt.Columns.Add("MyColumn", GetType(System.Boolean))
dt.LoadDataRow(New Object() {True}, True)
dt.LoadDataRow(New Object() {True}, True)
dt.LoadDataRow(New Object() {True}, True)
dt.LoadDataRow(New Object() {True}, True)
Dim ts As New DataGridTableStyle
ts.MappingName = dt.TableName
Dim column As New DataGridBoolColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column.MappingName = dt.Columns(0).ColumnName
column.ReadOnly = True
DataGrid1.DataSource = dt
///
I hope this helps,

Cor
Nov 21 '05 #4

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

Similar topics

4
by: John | last post by:
Hello all, I'm trying to display a dataset into a datagrid and format the datagrid columns but I'm having a hard time with it. I've tried the MSDN examples but they don't seem to work. ...
0
by: Morné | last post by:
Hi how do I validate a text value in a datagrid e.g. the user is only allowed to type in a Y or a N. I specifically have a problem with using the PropertyDescriptorCollection. I get the...
5
by: Jeff Cook | last post by:
Hi I have a DataGrid that I am using to display a .xml file (that has a schema in a .xsd), like this:- ds.ReadXmlSchema(sDataPath + "Data.xsd"); ds.ReadXml(sDataPath + "Data.xml",...
1
by: Jim Ptak via .NET 247 | last post by:
I am desperate for help. I am at a loss. I have a dataset with 4columns in it. The first column is an actual column from adatabase table. The last three columns are hard codded values of0. I am using...
3
by: Richard | last post by:
I tried boolCol.ReadOnly = true and a bunch of other things but can't get the check boxes for the datagrid's column for all rows to be disabled? Can someone tell me how to do this? ...
2
by: Raj | last post by:
Hi, When we are sorting the DataGrid Boolean column the grid is becoming redcross. I have my own PPMIPDataGridBoolColumn class inherited from System.Windows.Forms.DataGridBoolColumn. In this...
2
by: sianan | last post by:
I have a DataGrid which displays data from a table in a MS SQL 2000 database. My problem is that I have a bit column in the database whose values I want to display as checkboxes in the DataGrid. I...
4
by: Pacific Design Studios | last post by:
I have a DataGrid on Form1 that displays a small amount of information about employees. On Form2 I want to have all the data displaying in text boxes about the employee selected in the datagrid on...
2
by: Agnes | last post by:
In myDatagrid, there is 3 columns, account code, debit,credit. If the user input some particular a account code in column1 , i need to based on the contect of column1, to disable...
3
by: GatorBait | last post by:
Hi all, I'm using a datagrid for the first time and I am running into some problems that I hope someone can help me with. I have a datagrid with 18 rows and 5 columns....column 1 is just text...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.