473,396 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Hide the columns for members from parent class in grid

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<IWorkerItemBasebaseList =
worker.SelectedItems;

SortableBindingList<DistributionItemdistList = 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;
Jan 14 '08 #1
2 1236
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!
|
*************************************************
"Curious" <fi********@yahoo.comwrote in message
news:83**********************************@j78g2000 hsd.googlegroups.com...
>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<IWorkerItemBasebaseList =
worker.SelectedItems;

SortableBindingList<DistributionItemdistList = 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;

Jan 14 '08 #2
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.
Jan 14 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Suzanne Vogel | last post by:
Hi, Given: I have a class with protected or private data members, some of them without accessor methods. It's someone else's class, so I can't change it. (eg, I can't add accessor methods to the...
6
by: Alex Sedow | last post by:
Example 1 interface I { string ToString(); } public class C : I { public void f() {
12
by: Jerad Rose | last post by:
I searched for a while trying to find the answer to this, but to no avail. I am trying to find the best way (or any way) to dynamically show and hide groups of TR's. For example, I have a...
4
by: Paul Wu | last post by:
Is there a way to constract a derived class that hides certain public members of a base class ? With the following code, a class that derives from DerivedClass can still see the member "Name" in the...
5
by: Shane Story | last post by:
I have a dataset with two tables. I make data view of each table, connect the parent table to one data grid and the child table to the other datagrid, with a row filter, that gets set when a...
0
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i...
14
by: lovecreatesbea... | last post by:
Could you tell me how many class members the C++ language synthesizes for a class type? Which members in a class aren't derived from parent classes? I have read the book The C++ Programming...
4
by: Luqman | last post by:
I have populated the Child Accounts and Parent Accounts in a Grid View Control, I want to hide the Select Column of Parent Accounts, but not the Child Accounts, is it possible ? I am using VS...
9
by: moondaddy | last post by:
using c# 3.5 I have list of business objects which I will use in lists for databinding and I want to hide some of the fields so they don't show up in the list control. some of my list will be:...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.