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

ColumnMapping and Fill

P: n/a

I use DataGrid which displays data in several columns. Number of columns
depends on user prefferences (I mean: this is still the same query filling
datatable but I use "DataTable.Columns(i).ColumnMapping =
MappingType.Hidden" to hide columns which should be hidden). So, the code I
use every time to fill DataTable and display data in DataGrid looks like:

Private Sub xxxxx(...)
Dim firstTime as Boolean = true
if not dataset.Tables("table") is nothing
firstTime = false
End If
For i = 0 to dataset.Tables("table").Columns.Count - 1
dataset.Tables("table").Columns(i).ColumnMapping = iif (condition,
MappingType.Hidden, MappingType.Element)
If firstTime
dataGrid.DataSource = dataset.Tables("table").DefaultView
End If
End Sub

It works fine only at first. It sets some of columns visible and hides
others. But already in the second invocation there's no effect. Columns
which were visible are still visible and hidden ones are hidden.

Thanks for any help
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.