0
我使用visual studio的編輯模板視圖,它爲我創建了一個漂亮的窗體。問題是沒有任何對象數據包含在表單中。例如看到這一段代碼:asp.net MVC microsoft編輯模板不包括顯示對象數據
<div class="editor-label">
<%: Html.LabelFor(model => model.VideoDesc) %>
</div>
<div class="editor-field">
<%: Html.EditorFor(model => model.VideoDesc) %>
<%: Html.ValidationMessageFor(model => model.VideoDesc) %>
</div>
在服務器端,我有以下幾點:
public ActionResult editvid(int id)
{
using (VideoDBEntities ent = new VideoDBEntities())
{
var vids = from myRow in ent.Videos
where (myRow.VideoId == id)
select myRow;
ViewData["model"] = vids.ToList()[0];
}
return View();
}
我是新來的MVC和LINQ,並試圖找到我的腳
感謝 Andy
超級砸超級工作了一種享受! –