Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2007

Tip: Looking for answers? Try searching our database.

Display related DbLinq object property in DataGridView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrus - 20 Dec 2007 18:00 GMT
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.
Nicholas Paldino [.NET/C# MVP] - 20 Dec 2007 18:11 GMT
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.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> I have DbLinq-Sql class containing invoice headers.
>
[quoted text clipped - 37 lines]
>
> Andrus.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.