I am having problem displaying the modal dialog in mvc3 project, I found the code below and tried to use it but I am getting an error, I am sure I am missing something I hope someone can help me with this:
<script type="text/javascript">
$(function () {
$('#dialog').dialog({
autoOpen: false,
width: 400,
resizable: false,
title: 'hi there',
modal: true,
open: function(event, ui) {
//Load the CreateAlbumPartial action which will return
// the partial view _CreateAlbumPartial
$(this).load("@Url.Action("CreateAlbumPartial")");
},
buttons: {
"Close": function () {
$(this).dialog("close");
}
}
});
$('#my-button').click(function () {
$('#dialog').dialog('open');
});
});
public ActionResult CreateAlbumPartial()
{
return View("_CreateAlbumPartial");
}
my error is: “Microsoft jscript runtime error: Object does not support property or method ‘dialog’ ”
I will also appreciate if someone can show me other examples, I want to display a modal dialog in my page.
Thanks in advance!
Have you added the jQuery AND the jQuery UI libraries?
.dialog is a method provided by jQuery UI, not jQuery.