I want datagrid not to show all columns of dataset table

  • Thread starter Thread starter Jan Driesen
  • Start date Start date
J

Jan Driesen

I created a Datagrid and made a bind with a Dataset Table.
I don't want to see all the colums of the table, so a made a TableStyle and
two ColumnStyles (at design time).
When I run my application all the columns of the table are shown instead of
the two I made of my own.

I can, of course, change the select query to create my dataset whith less
columns , but I want to use the same dataset elsewhere.

Does anybody knows wat goes wrong here?


Thanks,

Jan Driesen
 
Your TableStyle "MappingName" must be the same as the name of the DataTable
you are binding to.

You can get/set your DataTable name with the DataTable.TableName property.

Also, each ColumnStyle has a MappingName that must be set to the name of the
DataColumn ( most likely the same as what's returned from the SQL
statement ).

~Greg
 
Jan said:
I created a Datagrid and made a bind with a Dataset Table.
I don't want to see all the colums of the table, so a made a
TableStyle and two ColumnStyles (at design time).
When I run my application all the columns of the table are shown
instead of the two I made of my own.

I can, of course, change the select query to create my dataset whith
less columns , but I want to use the same dataset elsewhere.

Does anybody knows wat goes wrong here?


Thanks,

Jan Driesen

Set AutoGenerateColumns to false, and add the appropriate
BoundColumn's to the datagrid.
 
Back
Top