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# / March 2008

Tip: Looking for answers? Try searching our database.

Master / Detail w/ IList

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
news.microsoft.com - 20 Mar 2008 11:54 GMT
I have a few classes that I need to present a master detail relationship in
a pair of DataGridViews, i.e.,

class SomeDataList : List<SomeData>

class MyMaster : List<MyDetail> {}
class MyDetail
{
  SomeDataList myData;
}

I have setup the first DataGridView
masterDataGridView.DataSource = myMaster;

And I get the list of MyDetails as expected.

Now, when I click on an instance of MyDetail in the DataGridView, I want to
have the detailDataGridView to show the contents of myData... but I'm not
sure how to setup the DataSource, Binding, etc...

Any ideas?
I
Marc Gravell - 20 Mar 2008 13:17 GMT
detailGrid.DataMember = "MyData";
masterGrid.DataSource = detailGrid.DataSource = myMaster;

where MyData is the name of a public property to the inner list.

Because the DataSource is the same, the currency-manager should keep the two
in-sync.

Marc
news.microsoft.com - 20 Mar 2008 17:55 GMT
Awesome.. thank you very much.

Is there a more 'type safe' way of defining:
detailGrid.DataMember="MyData", i.e., a way to get the propery name using
reflection or something on the class.. I just feel a bit funny putting in a
string literal.

Thx again.

> detailGrid.DataMember = "MyData";
> masterGrid.DataSource = detailGrid.DataSource = myMaster;
[quoted text clipped - 5 lines]
>
> Marc
Marc Gravell - 21 Mar 2008 01:26 GMT
No. Sorry.

Google for "infoof" for what may be in future...

Rate this thread:







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.