Hide the columns for members from parent class in grid

  • Thread starter Thread starter Curious
  • Start date Start date
C

Curious

I have a derived class (DistributionItem) that contains a few members.
Now I have a binding list of instances of this class to be displayed
in a grid.

However, extra columns are displayed from the parent class
(IWorkerItemBase). How can I hide those members from the parent class
in the grid?

FYI, my code is below:

SortableBindingList<IWorkerItemBase> baseList =
worker.SelectedItems;

SortableBindingList<DistributionItem> distList = new
SortableBindingList<DistributionItem>();

foreach (IWorkerItemBase bse in baseList)
{

// Safe cast
DistributionItem dist = bse as DistributionItem;

if (dist == null)
{
return;
}

// If it's DistributionItem
distList.Add(dist);

}

c1FlexGrid1.DataSource = distList;
 
My first thought is to edit the tags and restrict what is shown there.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
I did that by setting the columns in the grid properties. However, it
still loads extra columns including those in the parent class. It
seems that it ignores the properties of the grid set in the grid
properties dialog, once the datasource is set in the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top