Getting error "Method arguments are not valid! See validationErrors for details " when posting ajax beginform in mvc

When I am trying to post regular Ajax.BeginForm in my MVC project ( zero boilerplate project), I am getting this error

Method arguments are not valid! See ValidationErrors for details

Here is the image of the error


My Form is regular one nothing new, C# Controller code is below

        public JsonResult CreateNew(TenantCommission tc)
            using (var context = new bwEntities())

            return Json(true);

Razor Code

<div class="col-lg-12">
    @using (Ajax.BeginForm(CreateNew,
                                new AjaxOptions { OnSuccess = "OnSuccess", OnFailure = "OnFailure" }))
        <div class="row">

            <div class="col-lg-12">
                Commission (%):
                    @Html.TextBoxFor(a=>a.Commission,new { @class="onlyDigit"})


          <!--Code removed for clarity-->



I am not sure what's the issue, any Idea or link to resolve this issue? Thanks

Asked by:- Sam
: 6868 At:- 4/24/2018 6:01:06 PM
MVC C# zero boilerplate

1 Answers
profileImage Answered by:- jaya

You can stop getting this error in your ASP.NET zero boilerplate template project by adding this simple line in your ProjectNameWebModule.cs file's PreInitialize method

Configuration.Modules.AbpMvc().IsValidationEnabledForControllers = false;

So, if your project name is ABC file would be like

 public class ABCWebModule : AbpModule
        public override void PreInitialize()
            // code  lines removed
            Configuration.Modules.AbpMvc().IsValidationEnabledForControllers = false;

           // code lines removed

        //code removed

Build your project and try to submit the form again, should work.

At:- 4/25/2018 11:19:28 AM
Thanks, worked for me :) 0
By : Sam - at :- 5/1/2018 2:16:49 PM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use