0
我開始爲ASP.NET MVC 4使用完整的Kendo UI。 我已經創建了我需要的數據庫和模型,但現在我希望能夠處理(索引,創建,刪除,詳細信息和編輯)每個選項卡內容中的實體。但我不知道如何在tab tabs內部執行此操作。 (我開始與該會已經HomeController的互聯網應用程序模板)如何在TabStrip中處理索引,創建,刪除,詳細信息和編輯視圖?
我的代碼到現在爲止是:
/瀏覽/首頁/指數
@{
ViewBag.Title = "Home Page";
}
@(Html.Kendo().TabStrip()
.Name("tabstrip")
.Items(items =>
{
items.Add().Text("Students").Selected(true).LoadContentFrom("Index","Student"); //Add item with text "Students"
items.Add().Text("Teachers");
items.Add().Text("Schools");
})
)
/控制器/ StudentController
public class StudentController : Controller
{
private MiniSIGEdb db = new MiniSIGEdb();
//
// GET: /Student/
public ActionResult Index()
{
var students = db.Students.Include(s => s.Person).Include(s => s.School);
return PartialView(students.ToList());
}
//
// GET: /Student/Create
public ActionResult Create()
{
ViewBag.Person_id = new SelectList(db.People, "id", "FirstName");
ViewBag.School_id = new SelectList(db.Schools, "id", "City");
return PartialView();
}
protected override void Dispose(bool disposing)
{
db.Dispose();
base.Dispose(disposing);
}
}
/views/Student/Index
@model IEnumerable<MiniSIGEweb.Models.Student>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.Course)
</th>
<th>
@Html.DisplayNameFor(model => model.Person.FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.School.City)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Course)
</td>
<td>
@Html.DisplayFor(modelItem => item.Person.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.School.City)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.id }) |
@Html.ActionLink("Details", "Details", new { id=item.id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.id })
</td>
</tr>
}
</table>
到現在爲止,我能夠證明德索引視圖(如partialview),但是當我點擊「新建」,創建視圖是不是標籤欄裏面呈現的?我怎樣才能做到這一點?