Here, have a look:
load partial view in to a modal popup[
^]
Sample, Controller:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Modal()
{
return PartialView();
}
}
then a Modal.cshtml partial that will contain the partial markup that you want to display in the modal:
<div>This is the partial view</div>
and an Index.cshtml view containing the button which will show the partial into a modal when clicked:
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('.modal').click(function () {
$('<div />').appendTo('body').dialog({
close: function (event, ui) {
dialog.remove();
},
modal: true
}).load(this.href, {});
return false;
});
});
</script>
@Html.ActionLink("show modal", "modal", null, new { @class = "modal" })
Try!