jquery - calling partial view as popup window on click of ajax actionlink -
i trying open partial view popup window should contain image on click of ajax action link
@ajax.actionlink("view document", "viewdocument","property", new routevaluedictionary { { "id", viewbag.documentname } }, new ajaxoptions{ httpmethod="get", insertionmode=insertionmode.replace, loadingelementid="loading", updatetargetid = "view" })
and using id finding filename , path of image , returning partial view
public actionresult viewdocument(int id) { var document = db.documents.where(d => d.id == id).firstordefault(); var documentfilename = document.filename; viewbag.document = string.format("~/app_data/uploads/{0}.jpg",documentfilename); return partialview(); }
and partial view looks like
@model mvc5application.models.property <img src="@viewbag.document" alt="" />
and using jquery on click of ajax link
and jquery popup partial view
$(function () { $(document).dialog({ autoopen: false, width: 1500, resizable: false, modal: true }); }); $(document).ready(function() { $('#view document').click(function () { $(document).load("@url.action("@viewbag.document")", function () { $(document).dialog('open'); });`enter code here` return false; }); });
i dont know whether correct or not. new mvc please can 1 solve same.
advance thanks.
firstly left out [httpget] on controller method , use break point on see if hit when actionlink clicked.
Comments
Post a Comment