传递变量Ajax.ActionLink的onSuccess,的onComplete,onFailure处等 [英] Passing variable to Ajax.ActionLink OnSuccess, OnComplete, OnFailure, etc

查看:414
本文介绍了传递变量Ajax.ActionLink的onSuccess,的onComplete,onFailure处等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个div我的母版页,我可以从我的网站的更新任何位置更新。即记载更新,有错误,等等。

我会以不同的风格股利取决于更新的类型。 失败,成功,信息。基本的东西为止。

所以,我有整个网站的几个ActionLinks,它们显示在updateTarget其内容很好,我甚至可以让他们运行正常,当我经过的onComplete,OnBegin等功能给他们。不过,我希望能够将参数发送到该OnBegin功能。

例如:
    .OnBegin =someFunction('失败');

这是如何完成我在做什么在这里的任何想法?


解决方案

 <%字符串消息=失败; %GT;
        &所述;%= Ajax.ActionLink(的TestController,TestAction,
新AjaxOptions {OnBegin =myFunction的('+消息+')})%GT;

I'd like to put a div on my master page that I can update from anywhere in my site with updates. i.e. "recorded updated", "there was an error", etc.

I'm going to style the div differently depending on the type of update. "fail", "success", "info". Basic stuff so far.

So I have several ActionLinks throughout the site and they display their content fine in the updateTarget and I can even have them run fine when I pass OnComplete, OnBegin, etc. functions to them. However, I'd like to be able to send a parameter to that OnBegin function.

Example: .OnBegin="someFunction('fail');"

Any ideas on how to accomplish what I'm doing here?

解决方案

 <% string message = "failed"; %>
        <%=Ajax.ActionLink("TestController","TestAction",
new AjaxOptions{OnBegin="myFunction('" + message + "')"}) %>

这篇关于传递变量Ajax.ActionLink的onSuccess,的onComplete,onFailure处等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆