Hi,
Does anyone have any suggestions/ best practices for doing master/ detail pages using the ASP.NET MVC Framework?
Background
I've got a page of Client information, under each one I need to display 0 or more related records about that client.
The database schema looks something like this:
Clients -- one to many --> ClientData
I'm currently using LINQ for the data classes which is being populated using stored procedures. So to get the client information I'd write:
var clientQuery = from client in dataContext.GetClients ()
orderby client.CompanyName
select client;
When each client is rendered in the view, I need to display the related data, so I'd need to call this for each client found:
var clientDataQuery = from clientData in dataContext.GetClientData (client.ClientId)
orderby clientData.CreatedDate
select clientData;
Question
What's the best of achieving this?
- Use the ViewData and store each query
- Use the typed model of the view (perhaps using a class to represent a client with the related information in a list
- Other...
Thanks, Kieron