ASP.Net MVC 3.0 Ajax.ActionLink Onbegin功能的真正执行动作? [英] ASP.Net MVC 3.0 Ajax.ActionLink Onbegin Function true the execute the action?

查看:408
本文介绍了ASP.Net MVC 3.0 Ajax.ActionLink Onbegin功能的真正执行动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个阿贾克斯动作链接,这将调用一个操作方法,

I have a Ajax Action link, which will call a action Method,

在我的Ajax选项我已经叫验证功能,

In my Ajax Option i have called a Validate function,

如果这个函数返回true,

If this function returns true,

那么只有我希望这个行动执行,不知道如何我能得到这个工作?

then only i would want this Action Execute, not sure how i can get this done?

我的Ajax ActionLink的

My Ajax ActionLink

Ajax.ActionLink("Renew", "Edit", "Controller", new { id = "<#= ID #>" }, 
new AjaxOptions
                    {
                        OnBegin = "isValidDate",
                        OnSuccess = "DestroyRecreateAccordion",
                        UpdateTargetId = "accordion",
                        InsertionMode = InsertionMode.InsertAfter,
                    }, new { @class = "standard button" })

我怎样才能做到这仅如果isValidDate返回true?

How can I do this only if isValidDate returns true?

推荐答案

AjaxOptions 行动链接

OnBegin="isValidDate"

JavaScript的

JavaScript

   function isValidDate() {
       var date = $('#dateid').val()'
       //...check date....
       if(date is valid) return true;
       else return false;
    }

此工作

这篇关于ASP.Net MVC 3.0 Ajax.ActionLink Onbegin功能的真正执行动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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