Display related DbLinq object property in DataGridView

A

Andrus

I have DbLinq-Sql class containing invoice headers.

Invoice header class definition contains customer id field _customer which
is related to customer table:


[Table(Name = "invoice")]
public partial class Invoice: IModified {

protected string _customer;
protected string _id;

[Column(Name = "id", DbType = "integer(32,0)", IsPrimaryKey = true,
IsDbGenerated = true)]
public int Id {
get { return _id; }
set { _id = value; IsModified = true; }
}

private EntityRef<Klient> _invoice_customer_fkey_customer;

[Association(Storage="_customer",
ThisKey="customer",Name="invoice_customer_fkey")]
public Customer invoice_customer_fkey_customer {
get { return this._invoice_customer_fkey_customer.Entity; }
set { this._invoice_customer_fkey_customer.Entity = value; }
}
}

I want to show invoice header data and customer name in .NET 2 WinForms
DataGridView.

I need to set DataGridView column to display values from Invoice and
Customer entities,
the following properties from List<Invoice> Invoices:

Invoices.Id
Invoices.invoice_customer_fkey_customer.Name

Any idea how to create such DataGridView ?

Andrus.
 
N

Nicholas Paldino [.NET/C# MVP]

Andrus,

You are going to have to flatten out that structure manually, either by
creating a new type/data table and then populating that, or you will have to
create some custom type descriptors which the data grid view will work with
to flatten the structure.
 

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

Top