I want to show a Dialog, I am using jquery ui with asp.net mvc 3.0
The problem is: no open any dialog only a white page. This my code.
I have a form and inside a link, it must be open the Dialog with data.
<%= Html.ActionLink("Select Image", "SelectImage", "Image", new { @class = "popup-link" })%>
my SelectImage method do that
public ActionResult SelectImage()
{
List<ImageLibraryItem> data = new List<ImageLibraryItem>();
data = StateManager.SelectImage(ImageType.Flights);
var datajson = new
{
lista= data
};
return Json(datajson, JsonRequestBehavior.AllowGet);
}
}
and return the images that I want show.
In the same view where I have my link (the first) I put this:
<script language="javascript" type="text/javascript">
$(function () {
$('.popup-link').click(function () {
var href = $(this).attr('href');
$('<div><p class="popup-content"></p></div>').dialog({
autoOpen: true,
modal: true,
height: 200,
width: 400,
open: function () {
$(this).find('.popup-content').load(href);
},
close: function () {
$(this).dialog('destroy');
}
});
return false;
});
});
</script>
any idea!!! why show me a white page and not a Dialog!!!
You are using a wrong overload of the ActionLink helper. It should be like this in order to for it to point to the correct controller action:
whereas you are using this: