alexk Posted July 31, 2002 Posted July 31, 2002 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. Quote
Gazzo Posted August 7, 2002 Posted August 7, 2002 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. Quote
alexk Posted August 11, 2002 Author Posted August 11, 2002 Your example is work in VB but not in ASP.NET However thanks about your care. Quote
ombun2 Posted February 14, 2005 Posted February 14, 2005 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.