In my MVC application I open a popup window after clicking Create button, but I cannot render my partialview render in it. What I want to do is simply render partialview in the popup dialog and pass model and some parameters (i.e. id=1) to it. Could you please tell me where is the mistake? Thanks in advance.
Note: Any solution using bootstrap modal would also been appreciated...
View:
@(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>
Controller:
[HttpGet]
public ActionResult _Create()
{
var model = repository.Employee;
return PartialView(model);
}
PartialView:
@model Employee
<div>MY PARTIAL VIEW CONTENT GOES HERE ...</div>
</script>tag at the end of your View. - Banovcontentproperty to request a partial content. I use the jQuery'sload()method on the content div, then after content loaded I show the window. - DontVoteMeDown