What is the best way to link lists together in Orchard?
For example- I have one companies list and one projects list. When I create project, I want to associate it with a company...ideally, a drop down box pre-populated with the companies that I have created.
What is the best way to go about it?
P.S. I am using Orchard 1.3
Many thanks!
To see an example of pre-populating a checkbox or droplist in an Editor view, look at the Orchard docs 1-N / N-N example.
To see an example of setting up a relationship between two different parts via a droplist, look at the FeaturedItemSlider or the ContentSlider (which was derived from the former) Orchard modules on Codeplex or the Orchard gallery.
projectPart.CompanyPart = _companiesRepo.Get(companyId)
I'm not sure how you plan to use this relation on the front end. There are two ways to go about it. (1) you can create a custom controller with matching Route, and in the controller have code to look up the parts based on the relationship you've set up, or (2) in the ProjectPartDriver.Display() method you can do the lookup using IContentManager.