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

Trouble Hiding DataGrid Columns

Frinavale
Expert Mod 5K+
P: 9,731
Platform: Windows XP with IIS
Language: VB .NET (web application)


Hi there!

I've currently created a dataGrid with a dataView as its source. The dataView is made up based on DataTable that is made up from an array holding a bunch of data.

When doing sorting the dataView is re-arranged and in order to be able to select the correct object from the underlieing array for further manipulation I have added a column to the DataTable called "ArrayIndex". I would like to hide this column.

I have tried just about everything to do so. My latest attempts included things like:

Expand|Select|Wrap|Line Numbers
  1.  dg_searchResults.DataSource() = dv
  2.  dg_searchResults.DataBind()
  3.   For Each col As DataGridColumn In dg_searchResults.Columns
  4.       If col.HeaderText.Equals("ArrayIndex") Then
  5.           col.Visible = False
  6.       End If
  7.    Next
  8.  
and
Expand|Select|Wrap|Line Numbers
  1.  dg_searchResults.DataSource() = dv
  2.  dg_searchResults.DataBind()
  3.  dg_searchResults.Columns(4).Visible=False
  4.  
But these, like the other attempts, do not work.

Does anyone have any thoughts on this?

Thanks a lot
Nov 7 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.