怎么做MVC C#中的详细表格 [英] How to do Detail tablesin MVC C#

查看:225
本文介绍了怎么做MVC C#中的详细表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是MVC新手。我有一个在vb.net上开发的库存系统,我想在c#中使用MVC重新编码。所以继承我的问题。我有购买订单的视图,即tblPurchaseOrders。我希望这个视图里面有一个绑定到详细信息表tblPurchaseORder_Items的网格。我该怎么做呢?非常感谢。我希望你能帮助我。

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.

推荐答案

它应该很简单。将IEnumerable of Model从控制器传递给视图。



然后在剃刀视图中迭代IEnumerable并显示每行中每个模型对象的属性



应该看起来像



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

<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


这篇关于怎么做MVC C#中的详细表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆