无法在模态弹出窗口中呈现 PartialView (Kendo window)

Cannot render PartialView in modal popup (Kendo window)

在我的 MVC 应用程序中,我在单击“创建”按钮后打开了一个弹出窗口 window,但我无法在其中渲染我的局部视图渲染。我想做的只是在弹出对话框中 渲染部分视图 并向其 传递模型和一些参数 (即 id=1)。你能告诉我错误在哪里吗?提前致谢。

注意:任何使用bootstrap模态的解决方案也将不胜感激...

查看:

@(Html.Kendo().Window()
    .Name("CreateWindow")
    .Title("Create Employee")
    .Visible(false)
    .Draggable(true)
    .LoadContentFrom("_Create", "Employee")
    .Width(800)
    .Modal(true)
    .Content("Loading Part List Info...")
    .Draggable()
    .Resizable()
)


<script type='text/javascript'>
$(function () {
    // When your button is clicked
    $('#createbtn').click(function () {
        var createWindow = $('#CreateWindow').data('kendoWindow');
        createWindow.center().open();
    });
});
</script>


控制器:

[HttpGet]
public ActionResult _Create()
{
    var model = repository.Employee;
    return PartialView(model);
}


局部视图:

@model Employee

<div>MY PARTIAL VIEW CONTENT GOES HERE ...</div>


这是我的工作代码,希望对您有所帮助:

查看:

@{ ViewBag.Title = "Test"; }
@Styles.Render("~/Content/kendoui/css")

<input type="button" id="createbtn" value="Test kWindow"/>

@(Html.Kendo().Window()
    .Name("CreateWindow")
    .Title("Create Employee")
    .Visible(false)
    .Draggable(true)
    .LoadContentFrom("_Create", "Employee", new { id = 1 })
    .Width(800)
    .Modal(true)
    .Content("Loading Part List Info...")
    .Draggable()
    .Resizable()
)

@Scripts.Render("~/bundles/kendoui")
<script type='text/javascript'>
$(function () {
    // When your button is clicked
    $('#createbtn').click(function () {
        var createWindow = $('#CreateWindow').data('kendoWindow');
        createWindow.center().open();
    });
});
</script>

局部视图:

@model Banov.Controllers.Employee
<div>MY PARTIAL VIEW CONTENT GOES HERE ...</div>
<div>@(Model.Id)</div>
<div>@(Model.FirstName)</div>
<div>@(Model.LastName)</div>

控制器:

using System.Web.Mvc;
namespace Banov.Controllers
{
    public class EmployeeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public ActionResult _Create(int id)
        {
            var model = new Employee
                    {
                        Id = id,
                        FirstName = "John",
                        LastName = "Doe"
                    };
            return PartialView(model);
        }
    }

    public class Employee
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
}