控制器:
public ActionResult Index()
{
DataTable dt = CustomerInfo.GetList().Tables[0];
List<DbCon_view> list = CustomerInfo.GetModel() as List<DbCon_view>;
if (list.Count > 0)
{
return View(list+dt);
} }
默認的是希望用戶一進來就顯示菜單和一個列表 對應(yīng)的結(jié)果集是 dt:list
如何返回啊這2個一起?
視圖:
@model System.Data.DataTable
@using WC_DBConsole.Models
@{
ViewBag.Title = "Index";
}
<link href="@Url.Content("~/Content/LeftCss.css")" rel="stylesheet" type="text/css" />
<div id="LeftMenu" class="LeftMenu">
<ul>
@foreach (System.Data.DataRow item in Model.Rows)
{
<li><a id="MeauID" href="#">@item["Customer_Name"]</a></li>
}
</ul>
</div>
這個?List<DbCon_view> list = CustomerInfo.GetModel() as List<DbCon_view>;命名空間怎么導(dǎo)入啊 要不會提示
“/”應(yīng)用程序中的服務(wù)器錯誤。
傳入字典的模型項的類型為“System.Collections.Generic.List`1[WC_DBConsole.Models.DbCon_view]”,但此字典需要類型“System.Data.DataTable”的模型項。
急 等大俠 原諒我提出的低級問題.
- 3 回答
- 0 關(guān)注
- 432 瀏覽
添加回答
舉報
0/150
提交
取消