English 中文(简体)
mvc ajax。 与jquery dialog 相关的行动
原标题:mvc ajax.actionlink with jquery dialog confirm

我有一个数据项目的表格。 每一行都将是一些行动链接,称为一些方法(数据分项目、变化状况数据项目等)。

在每一用户点击 but but子之前,一只需要一个 j子的方言,以显示和向用户提供一些信息、一个科索沃和Cancel纽吨的方言。

麻省的一些实例。 将称为“变化现状”方法的行动链接:

<%= Ajax.ActionLink(item.Status, "ChangeStatus", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "ListReturns-Div", OnBegin = "StartChangeStatus", OnSuccess = "EndChangeStatus", OnFailure = "FailureChangeStatus" }, new { @class = "StatusBtn" })%>

这是一项叫作:

 function StartChangeStatus(e) {
            $( #dialog-confirm ).dialog({
                resizable: false,
                height: 200,
                modal: true,
                buttons: {
                     Continue : function () {
                        $(this).dialog( close );
                        $( #Loading-Div ).show( slow );
                    },
                    Cancel: function () {
                        $(this).dialog( close );
                        e.preventDefault();
                    }
                }
            });
        }

行动连线和支队职能运作。 但问题是,在行动联系点被点击时,不能暂停/停止目前的行动。 当 but子被点击时,霍乱过程正在进行,方言确认纽顿被忽视。 因此,我的问题是,如何改变行动联系或分类功能,以便在进行之前按要求进行辩证工作?

问题回答

我也尝试过你的法典,采取了同样的行为。 我修改了你的代码,以显示确认箱子。

<%= Ajax.ActionLink("Link", 
                    "ChangeStatus", 
                    new { id = 3 }, 
                    new AjaxOptions { UpdateTargetId = "ListReturns-Div", 
                                      HttpMethod = "Post", 
                                      Confirm = "confirmClick" }, 
                                      new { @class = "StatusBtn" }
                   )
%>

并且正在展示 j印。 需要找到为什么不工作的原因。

http://www.senseisterroom.net/lesson.asp?id=141“rel=“nofollow”>my :

Now, Ajax.ActionLink is really useful, and the Confirm AjaxOption is even more...still, who wants those crappy Javascript Alert these days? I am developing an application with Ms MVC 2 and I m using the fantastic JQueryUI library to customize the visuals of all my elements. One of the best things JQueryUI has, are dialog windows...those like "Are you sure to delete this file? Yes/No"... and I WANT TO USE THEM IN MY Ajax.ActionLink!

由于我没有找到关于这个净额的答案,我只想简单地这样做......现在我把这个净额放在这里。

第一,在您的网页上读和执行Ricardo Covo撰写的修读: “ASP MVC 删除与Ajax &的确认;j Query UI Dialog”(Just google it)

我简单地修改了他的 Java写法,只是使用去除()而不是藏匿(快速)的方法,并将一个“项目”的类别删除。

deleteLinkObj.closest("tr").hide( fast ) 

......

deleteLinkObj.closest("tr.item").remove();

现在,在你接过上届教学之后,你愿意替代你。

<%: Html.ActionLink([LinkName],[ActionName], new { id = item.Id }, new { @class = "delete-link" })%>

加入

<%:Ajax.ActionLink([LinkName],[ActionName],[ControllerName],new { id = item.Id },new AjaxOptions{HttpMethod = "Delete" /*You can use Post though*/,OnBegin = "JsonDeleteFile_OnBegin" /*This is the main point!*/}, new { @class = "delete-link" } ) %>

You can use the Post method if you like to, the important thing here is the OnBegin option, that calls a javascript that prevents the server action to be called before JQueryUI Dialog Confirmation:

<script language="javascript">function JsonDeleteFile_OnBegin(context) {return false;/*Prevent the Ajax.Action to fire before needed*/}</script>

在该网页上贴上 j印。

因此,现在的情况是: 当你点击删除的 but子时,它将在指定奥贝金职能(取消正常员额行动)的同时,开放联合调查。 在“公司”的情况下,Ricardo Covo的密码将发射服务器的辅助行动,在Ricardo Covo的javascript的确认书中,如果成功,你就能够执行所有行动(如隐藏删除的行文)。

<>Pay Note:用这种方法,你必须管理Ricardo Covo的javascript代码中的成功/失败的职能,因为翁丁斯和奥孔普特·阿贾克斯·奥佩斯根本不会被发射(很可能是某些法典所写的)。





相关问题
WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Post back complex object from client side

I m using ASP.NET MVC and Entity Framework. I m going to pass a complex entity to the client side and allow the user to modify it, and post it back to the controller. But I don t know how to do that ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required ...

asp.net mvc automapper parsing

let s say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; ...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor)...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

热门标签