1
我有一個JSON函數返回下面的數據,這是我所期待的:數據是有,但不能顯示
[{"ShowId":1,"Title":"The Forresters Axe","Date":"\/Date(1339714800000)\/","Time":{"Hours":19,"Minutes":0,"Seconds":0,"Milliseconds":0,"Ticks":684000000000,"Days":0,"TotalDays":0.79166666666666663,"TotalHours":19,"TotalMilliseconds":68400000,"TotalMinutes":1140,"TotalSeconds":68400}}]
但是當我嘗試以顯示我有問題的視圖頁上的標題。這是視圖頁面代碼:
<table> @foreach (var showList in Model) {<tr><td>@showList.Title</td></tr>}<.table>
這是我一直在使用的ActionResult但是當我撥通了看法我不能得到的數據顯示。我使用上面的JSON函數來檢查我是否擁有正確的數據,而不是試圖調用那些不存在的東西。
enter/*-------------------------------------------------------
BOOKING/CHECKAVAIL ACTIONRESULT CALLING CHECKAVAIL VIEW
Select information from Run table where the id == ShowId
------------------------------------------------------*/
public ActionResult CheckAvail(int id)
{
var showList = from r in db.Runs
join s in db.Shows on r.ShowId equals s.ShowId
where r.ShowId == id
select new
{
ShowId = r.ShowId,
Title = s.Title,
Date = r.Date,
Time = r.Time
};
return View(showList);
}
我得到的錯誤是:
RuntimeBinderException是通過代碼未處理
「對象」不包含標題