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 926355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:40:21+00:00 2026-05-15T19:40:21+00:00

So I have one custom model binder that inherits from DefaultModelBinder, where I am

  • 0

So I have one custom model binder that inherits from DefaultModelBinder, where I am overriding the BindProperty() method to handle a type of field we’ve created.

I also have one controller that we’d like to override BindModel() on, since we’re handling an object in session for multiple views with that controller.

So I have CustomModelBinder : DefaultModelBinder, and then in the class where we override BindModel() i have that inheriting from CustomModelBinder. SpecialModelBinder: CustomModelBinder

But I have set a breakpoint in our override of BindProperty() in CustomModelBinder, and this never gets hit when using the controller that is also overriding BindModel().

Can I not inherit like this? What’s happening here?

Thank You!

edit:

in global.asax:

ModelBinders.Binders.Add(typeof(ClassA), new SpecialModelBinder());
ModelBinders.Binders.Add(typeof(ClassB), new CustomModelBinder());
ModelBinders.Binders.Add(typeof(ClassC), new CustomModelBinder());
ModelBinders.Binders.Add(typeof(ClassD), new CustomModelBinder());

public class CustomModelBinder : DefaultModelBinder
{
    // this will be hit in controllers that handle classes B, C, and D, but will not be hit in controller that handles ClassA
    protected override void BindProperty(...){}
}

public class SpecialModelBinder : CustomModelBinder
{  
    // this will be hit when working in controller that handles ClassA only
    public override object BindModel(...){}
}
  • 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-05-15T19:40:22+00:00Added an answer on May 15, 2026 at 7:40 pm

    I recreated the scenario you described in an empty MVC application, and wasn’t able to replicate the situation you describe here. I had no problem subclassing SpecialModelBinder from CustomModelBinder and hitting both breakpoints in all classes. Is there any other informaiton you can provide that might illuminate a solution? As you describe it here, there should be no issue with hitting both breakpoints for ClassA and only the BindProperty method for B, C and D.

    Scenarios I tried:
    1) Edit ClassA. Result: BindModel() on SpecialModelBinder called and BindProperty() on CustomModelBinder called for each property on the class;
    2) Edit ClassB (or C or D). Result: BindProperty() on CustomModelBinder called for each property on the class.

    Is there anything else in your Application_Start() method in Global.asax, other than the Area and Route registration calls?

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

Sidebar

Related Questions

In my iPad App, I have one custom class inherited from UIButton. I am
DUPLICATE: Using a Django custom model method property in order_by() I have two models;
I have ContainerWidget and custom container type with ShowAllLinkCaption field. Now I have only
I have a custom validation rule on a model that says the user can't
I have one custom config file. <Students> <student> <Detail Name=abc Class=1st Year> <add key=Main
I have one custom website with code created 100% by me. I need to
I have one custom action (add) and two custom objects (favorites list) and (tv
I have one ViewController, in this i have added one Custom UIView named as
In my app i have created one custom class for Label.Now i want to
I have the following situation: There is one custom view inside of the first

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.