Just thinking out loud here, but if you stored your "foreign" prices in a Dictionary or similar data structure like so:
class Product {
public String PartNo { get; set; }
public String Description { get; set; }
public Decimal BasePrice { get; set; }
public Dictionary<String, Decimal> ForeignPrices;
}
Then you could write a simple routine that would take a collection of the above objects and convert it into a DataTable that you could then bind to. Said routine would always create the following columns:
PartNo, Description, BasePrice
It would then loop through the items in the Dictionary, adding additional columns for each item. So if you had three items in ForeignPrices:
ForeignPrices.Items.Add("AUD", 10.50);
ForeignPrices.Items.Add("GBP", 6.20);
ForeignPrices.Items.Add("CAD", 5.95);
You would end up with three additional columns on your dynamically-created DataTable:
PartNo, Description, BasePrice, AUD, GBP, CAD
Of course you may want to do away with the BasePrice property and just make "USD" another item in ForeignPrices (in which case it would simply be called Prices).
HTH.
Cory Grimster
2010-02-19 20:59:20