By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,581 Members | 1,811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,581 IT Pros & Developers. It's quick & easy.

Datagrid TableStyles question...

P: n/a
I'm attempting to display a datagrid with an EXTRA column: a checkbox
column. I successfully added it by creating a DataGridBoolColumn:

Dim ts1 As New DataGridTableStyle
ts1.MappingName = "Archive"
Dim colDiscontinued As New DataGridBoolColumn
With colDiscontinued
.MappingName = "abc"
.HeaderText = "xyz"
.Width = 80
End With
ts1.GridColumnStyles.Add(colDiscontinued)
DataGrid1.TableStyles.Add(ts1)

This works. BUT the resulting Datagrid ONLY shows this checkbox
column. I want this column to show up in addition to all the default
columns. Do I have to write code to show all the other columns, or is
there a simple way?

Also, I don't want to MAP this checkbox column with anything. I just
need checkboxes to show up next to each column for the user to click
on. Then i'll write code to determine what rows were selected and then
do something with them. If i leave the .Mappingname property blank,
the column just disappears. Any help/advice for this?

Thanks so much for all your help!
John

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
John,

The answer on the first question is yes, you need to set for all columns
styles, if you use one.

The second questions. The name of the datagrid is "datagrid" and not grid,
because it uses underlaying data.

There is no simple Grid as control in the Windowsform part of Net. However
I don't see your problem, accessing a column in a datatable is very easy and
when you need an empty one, you just add an extra one to your table.

DataTable.Columns.add("myBool",Gettype(system.Bool ean))

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
Cor,

Thanks for the info. The problem for me is that datatable.columns.add
adds a column to the "end". I really need it before all the columns.

I'm assuming that if I do this, I can then create a tablestyle where I
create all the columns, and just put the checkbox column at the
beginning. I'll try this out!

Thanks!
John

Nov 21 '05 #3

P: n/a
John,

Thanks for the info. The problem for me is that datatable.columns.add
adds a column to the "end". I really need it before all the columns.

I'm assuming that if I do this, I can then create a tablestyle where I
create all the columns, and just put the checkbox column at the
beginning. I'll try this out!

Therefore are the columnstyles they are used in your grid in the sequence as
you add them them to the styles. I really don't know how to make a decent
datagrid without the styles.

I hope this helps,

Cor
Nov 21 '05 #4

P: n/a
Helps alot, thanks! I just find this very complicated because I have
more experience w/ asp.net datagrids, which I think make much more
sense to me. I wish both types of datagrids worked more similarly. Oh
well. Thanks again!

John

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.