8
我有以下看法: -使用DisplayFor內每個循環
@foreach(var info in Model.Firewall.FirewallCustomers.OrderBy(a=>a.CustomerName)){
<td>@Html.DisplayFor(info.CustomerVLAN.VLANID)</td>
}
但我無法寫出下面的
@Html.DisplayFor(info.CustomerVLAN.VLANID)</td>
我會收到以下錯誤: -
The type arguments for method 'System.Web.Mvc.Html.DisplayExtensions.DisplayFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
因此,任何人都可以建議,如何在我的foeach循環中使用DisplayFor?
由於
嘗試用''foreach''中的''info''類型替換''var'' – acfrancis