日期:2014-05-17 浏览次数:20539 次
public class DataModel
{
public master Master { get; set; }
public IList<detail> Details { get; set; }
public DataModel()
{
Master = new master ();
Details = new List<detail>();
}
}
public virtual ActionResult Add()
{
DataModel model = new DataModel();
return View("add", model);
}
foreach (var item in Model.Details)
{
<tr >
<td>
@Html.TextBoxFor(modelItem => item.id)
</td>
<td>
@Html.TextBoxFor(modelItem => item.name)
</td>
.............
</tr>
}
[HttpPost]
public ActionResult Add(DataModel model)