关于ajax动作链接

编程入门 行业动态 更新时间:2024-10-19 06:22:25
本文介绍了关于ajax动作链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个类似下面的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动作链接

本文发布于:2023-11-24 21:00:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626801.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动作   链接   ajax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!