我有一个类似下面的ajax动作链接按钮
i have a ajax action link button like below
@Ajax.ActionLink("View Document", "ViewDocument","Property", new RouteValueDictionary { { "id", ViewBag.DocumentName } }, new AjaxOptions{ HttpMethod="GET", InsertionMode=InsertionMode.Replace, LoadingElementId="loading", UpdateTargetId = "View" })当我点击此链接时,我想重定向到带有链接ID的部分视图,并通过使用这个id我发现图像文件名如
whe i click on this link i want redirect to partial view with id of the link and there by using this id i am finding image file name like
public ActionResult ViewDocument(int id) { try { 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(); } catch (Exception ex) { throw ex; } }在局部视图中我有图像控制绑定文件,我在部分视图上方找到视图是 @model MVC5Application.Models.Property < img src =@ ViewBag.Documentalt =/> ; 我在点击ajax链接时使用jquery
in partial view i have image control to bind file which i have found above the partial view is @model MVC5Application.Models.Property <img src="@ViewBag.Document" alt="" /> and am using jquery on click of ajax link
$(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'); }); return false; }); });但它没有重定向局部视图。 任何人都可以帮我解决问题。
but it is not redirecting partial view. Can any one help me out tachieve the same.
推荐答案(function() { (function () {
(document).dialog({ autoOpen: false ,宽度: 1500 ,可调整大小: false , modal: true }); }); (document).dialog({ autoOpen: false, width: 1500, resizable: false, modal: true }); });
(document).ready(function(){ (document).ready(function() {
更多推荐
关于ajax动作链接
发布评论