Asp.net mvc 4 如何在TabStrip中处理索引、创建、删除、详细信息和编辑视图?

Asp.net mvc 4 如何在TabStrip中处理索引、创建、删除、详细信息和编辑视图?,asp.net-mvc-4,kendo-ui,Asp.net Mvc 4,Kendo Ui,我开始为ASP.NET MVC 4使用剑道UI complete。 我已经创建了所需的数据库和模型,但现在我希望能够处理(索引、创建、删除、详细信息和编辑)每个选项卡内容中的实体。但我不知道我怎么能在de tabstrip里面做到这一点。(我从已经有HomeController的Internet应用程序模板开始) 到目前为止,我的代码是: /Views/Home/Index @{ ViewBag.Title = "Home Page"; } @(Html.Kendo().TabStri

我开始为ASP.NET MVC 4使用剑道UI complete。 我已经创建了所需的数据库和模型,但现在我希望能够处理(索引、创建、删除、详细信息和编辑)每个选项卡内容中的实体。但我不知道我怎么能在de tabstrip里面做到这一点。(我从已经有HomeController的Internet应用程序模板开始)

到目前为止,我的代码是:

/Views/Home/Index

@{
    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"); 
                })
)
@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>
/Controllers/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

@{
    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"); 
                })
)
@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>
@model IEnumerable
@{
ViewBag.Title=“Index”;
}
指数

@ActionLink(“新建”、“创建”)

@DisplayNameFor(model=>model.Course) @DisplayNameFor(model=>model.Person.FirstName) @DisplayNameFor(model=>model.School.City) @foreach(模型中的var项目){ @DisplayFor(modelItem=>item.Course) @DisplayFor(modelItem=>item.Person.FirstName) @DisplayFor(modeleItem=>item.School.City) @ActionLink(“编辑”,“编辑”,新的{id=item.id})| @ActionLink(“详细信息”,“详细信息”,新的{id=item.id})| @ActionLink(“删除”,“删除”,新的{id=item.id}) }

到目前为止,我还能够显示de-Index视图(如partialview),但是当我单击“createnew”时,Create视图不会在tabstrip中呈现?我该怎么做

由于tabstrip是用Ajax加载的,这意味着用于编辑、创建和删除的其他每个视图也应该用Ajax加载

你可以看一看。在tabstrip中创建一些结果元素,这些元素应该使用Ajax加载的内容进行更新