C# Developers' Journal (original) (raw)

This is a long post about one problem I have with Microsoft Report Viewer reports for .NET 2.0. Please don't skip it :)

ok, I have a simple windows form with report viewer control placed on it. The datasource for my reports is an object described in a class. Most of the fields are pretty simple like:

public string ObjectOperationType
{
get
{
return ent.Offer.OfferType.ToString();
}
}

where "ent" is a business object the application uses.

Some fields, though, are bit more complex and return List<> of things, like:

public List ObjectCloseLocations()
{
List items = new List();
foreach (DirectoryEntry de in ent.Attributes[31].AvailableItemsList)
{
if (((ListDirectoryEntries)ent.Attributes[31]).Contains(de))
{
items.Add(new CloseLocations(de.Term, true));
}
else
{
items.Add(new CloseLocations(de.Term, false));
}
}
return items;
}

The CloseLocations type is a class with two public fields (Key and Value) that are filled by my method and then passed into the report as a list and the report will show the list in a table quite happily.

( closer to the problemCollapse )

the problem now is that the comfort List<> is not "bount" to it's parent object that shall be getting data from it. How can I fix this?

Has anyone dealed with this?