Hiding a column in a datagrid?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a datagrid that uses a dataview object for its datasource. The
dataview contains a unique row identifier column. I don't want to display
this column in the datagrid. I need the unique row Identifier column so that
I can run updates on the SqlAdapter object. Is there a way to hide this
column from the datagrid?

Dim dv1 As New DataView(ds.Tables("tbl1"))
dv1.AllowNew = False
dgr1.DataSource = dv1 '--dgr1 is the datagrid

I checked the dropdown lists for dv1 and dgr1 but did recognize anything for
hiding a column.

Thanks,
Rich
 
I just finished playing around with the datagrid table styles. My datagrid
has 22 fields. That was way less fun than doing the dv1...columnmapping
thing. Mostly because I couldn't get the tablestyle to work. I set the
desired column width to 0 for the column I want to hide, but it did not get
hidden. So I played around with dgr1.TableStyles(0) in the code and got
error messages. How do I hide my column with the tablestyles?
 
Rich,

How do I hide my column with the tablestyles?

When you do not "map" it, than it will not be showed using table styles.

When you still see them all, than there is probably something wrong in the
styles.

Cor
 
Hi,
I just finished playing around with the datagrid table styles. My datagrid
has 22 fields. That was way less fun than doing the dv1...columnmapping
thing. Mostly because I couldn't get the tablestyle to work. I set the
desired column width to 0 for the column I want to hide, but it did not get
hidden. So I played around with dgr1.TableStyles(0) in the code and got
error messages. How do I hide my column with the tablestyles?

I suggest you checkout the Windows Forms FAQ at
www.syncfusion.com/faq/windowsforms
There is a very detailed section about the Datagrid as well - that should
answer your TableStyle/ColumnStyle questions as well as a bunch of other
ones you'll probably come across in the near future. ;-)

Cheers,
Olaf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top