Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9127467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:17:20+00:00 2026-06-17T07:17:20+00:00

I have this Controller: [HttpPost] public JsonResult Execute(PaymentModel paymentModel){…} this is the model public

  • 0

I have this Controller:

[HttpPost]
public JsonResult Execute(PaymentModel paymentModel){...}

this is the model

public class PaymentModel
{
[Required]
[DisplayName("Full name")]
public string FullName { get; set; }
...
}

this is the binding action

 protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            ModelBinders.Binders.Add(typeof(PaymentModel), new PaymentModelsBinding());           
        }

this is the binding inplementation

public class PaymentModelsBinding : IModelBinder
    {
        public  object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
//Cant get to here with the debugger
}

I dont know if that is relevant or not, but I am injecting using Ninject to the controller constructor.

Update
This is how the form is submitted:

            $.ajax({
                type: 'POST',
                url: $("#form").attr("action"),
                data: $("#form").serialize(),
                success: function (json) {
                    ...

                },
                dataType: "Json"
            });

I want that to be restful, meaning I will to call it in every possible WEB way.
Browser Ajax, Browser Classic form submission, WebClient… and more.

Update
This is my ninject code:

kernel.Components.Add<IInjectionHeuristic, CustomInjectionHeuristic>();


            kernel.Bind<IPaymentMethodFactory>().ToProvider<PaymentMethodFactoryProvider>().InSingletonScope();
            kernel.Bind<IDefaultBll>().To<DefaultBll>().InSingletonScope();

            kernel
                .Bind<IDalSession>()
                .ToProvider<HttpDalSessionProvider>()
                .InRequestScope();

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:17:22+00:00Added an answer on June 17, 2026 at 7:17 am

    Sorry, I can’t see anything wrong with your code. This should work. And as a proof of concept, here’s what you could try:

    1. Create a new ASP.NET MVC 3 application using the Internet Template
    2. Define a view model:

          public class PaymentModel
          {
              [Required]
              [DisplayName("Full name")]
              public string FullName { get; set; }
          }
      
    3. A custom model binder:

      public class PaymentModelsBinding : IModelBinder
      {
          public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
          {
              return new PaymentModel();
          }
      }
      
    4. HomeController:

      public class HomeController : Controller
      {
          public ActionResult Index()
          {
              return View(new PaymentModel());
          }
      
          [HttpPost]
          public ActionResult Index(PaymentModel model)
          {
              return Json(new { success = true });
          }
      }
      
    5. A corresponding view (~/Views/Home/Index.cshtml):

      @model PaymentModel
      
      @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "form" }))
      {
          @Html.EditorFor(x => x.FullName)
          <button type="submit">OK</button>
      }
      
      <script type="text/javascript">
          $('#form').submit(function () {
              $.ajax({
                  type: this.method,
                  url: this.action,
                  data: $(this).serialize(),
                  success: function (json) {
      
                  }
              });
              return false;
          });
      </script>
      
    6. And finally register the model binder in Application_Start:

      ModelBinders.Binders.Add(typeof(PaymentModel), new PaymentModelsBinding());
      
    7. Run the application in Debug mode, submit the form and the custom model binder gets hit.

    So the question now becomes: what did you do differently?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a controller like this: [HttpPost] public JsonResult FindStuff(string query) { var
I have this controller: public class StandingsController : Controller { public ViewResult Index(int id)
Hi I have this as one of my controllers: [HttpPost] public JsonResult GetPinPoints(string Id)
i have this timer in c#: public class HomeController : Controller { public int
I have this function in my controller. [HttpPost] public ActionResult Edit(EmployeesViewModel viewModel) { Employee
This is the code that I have in my controller: [HttpPost] public ActionResult UpdateArticle(Article
I have the following controller [HttpPost] public JsonResult Update(List<DeliveryNoteDisplay> DeliveryNotes, UserSession userSession) { //
I have this controller [HttpPost] public ActionResult Compose(ComposeMessage composeMessage) { var message = ;
I have this controller: [HttpPost] public ActionResult Create(Company company) { // try to save
I have this controller in Code Igniter that begins with class MyController extends CI_Controller

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.