Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Datagrid - Windows - DataGridBoolColumn - How can I disable all the check boxes in the column

Reply
Thread Tools

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

 
 
Richard
Guest
Posts: n/a
 
      06-15-2005
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;


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      06-15-2005
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


 
Reply With Quote
 
 
 
 
Richard
Guest
Posts: n/a
 
      06-15-2005
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" <> wrote in message
news:%...
> 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
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      06-15-2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how to check all check boxes in repeater control kris ASP .Net 1 09-22-2005 07:16 PM
how to check all check boxes in repeater control kris ASP .Net 0 09-22-2005 06:29 PM
how to check all check boxes in repeater control kris ASP .Net 0 09-22-2005 06:29 PM
select all check boxes at a time with check all [Javascript] [Chatakondu Gallery] Suresh Javascript 2 04-22-2004 03:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57