Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I fill a DataSet control with records from *.mdb Database.

Then I bind a DataGrid control to the DataSet. All the columns are showed in the DataGrid, but not all of them are necessary to be visible to user...

How can I make some columns invisible???

My question is more relevant for ASP.NET than VB.NET

Thanks.

Posted

Hi alexk,

 

I can't remember exactly off the top of my head, but try something like this:

 

On the DataTable, with the columns that you don't want displayed, set the mapping type to MappingType.Hidden.

 

i.e. DS.Tables("tablename").Columns("nnnn").MappingType = MappingType.Hidden.

 

I've done something like this in VB.Net but not in ASP.Net.

 

Cheers,

Gazzo.

  • 2 years later...
Posted
The reason it might not work for you is because you have the AutoGenerateColumns of your DataGrid set to true. That will cause columns to show, but when you try to index them you'll get an index error. For example by using the property builder and adding a select, delete, and edit column and doing a datagrid.columns.count you'll see that it only returns 3 colums. what works for me is just using the property builder and adding them manually, then they will all be accessible to indexing

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...