Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi Guys,

I'm new in MVC. I have an inventory system developed on vb.net and i want to recode it using MVC in c#. So heres my problem. I have a view for purchase orders which is "tblPurchaseOrders". I want this view to have a grid inside it binded to a detail table tblPurchaseORder_Items. How do i do this? thank you so much. I hope you can help me.
Posted
Comments
F-ES Sitecore 21-Jul-15 6:57am    
A forum isn't the best place to learn something from scratch. Go through a book on MVC, or at least some on-line tutorials, they often cover showing data in a grid.

1 solution

it should be farely simple. Pass the IEnumerable of Model from controller to the view.

then in the razor view iterate through the IEnumerable and display each model object propertied in each column of a row

should look like

HTML
<table>
<tbody>
<tr>
<th>property1 heading</th>
<th>property2 heading</th>
<th>property3 heading</th>
</tr>
@foreach(var item in ienumerableist)
{
<tr>
<th>@item.propert1</th>
<th>>@item.propert2</th>
<th>>@item.propert3</th>
</tr>
}
<table><tbody>
</tbody></table></tbody></table>



Hope this will help you
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900