asp.net mvc Records Based On other
I want to create a listing view in which the record will be in this format(basically one record based on other, what approach i should follow) .
My table
Module1 Module1Feature Module1Feaure2 Module1Feature3 Module2 Module开发者_运维技巧2Feature Module2Feature2 Module2Feature3Basically Please Notice that the child records are based on the parent.
Assuming you are using LinqToSQL as your backend, then you probably already have your foriegn key relationships setup (right?). Which means that you should have a table with your modules and a table for your moduleFeatures with a FK back to table modules.
In your controller, you return all of your modules as such
Function Index() as actionresult
return(repository.getModules())
End Function
Then in your View, you can do something like this
For each module in model
Html.Encode(module.moduleName)
For each feature in module
Html.Encode(feature.featureName)
Next
Next
精彩评论