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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:20:08+00:00 2026-05-26T08:20:08+00:00

In a recent project – i’ve hit an unexpected snag. A class with simple

  • 0

In a recent project – i’ve hit an unexpected snag.
A class with simple public fields (note not properties) doesn’t seem to want to play nice with the
ASP.net MVC 3.0 model binder.

Is this by design?

besides changing the fields to properties – any options here?

update

The reason for the simple fields (instead of properties) is because I’m working with a shared library between MVC and a Script Sharp project. Script sharp supports properties – but it becomes a mess with javascript in the view (using knockout.js)

So despite what i’d love (which is to just use properties) i’m using public fields in my dto classes.

I wanted to avoid having multiple definitions of the same classes. sigh

  • 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-26T08:20:08+00:00Added an answer on May 26, 2026 at 8:20 am

    Is this by design?

    Yes, only properties with public getter/setters work with the default model binder.

    besides changing the fields to properties – any options here?

    That’s what you should do as you should be using view models anyway. And view models are specifically designed for the views. So changing the fields to properties is the correct way to do. Now if you don’t follow good practices and try to use your domain models as input/output to actions then you will have to write a custom model binder that works with fields. It will be a lot of work though.

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

Sidebar

Related Questions

In a recent project I was working I created a structure in my class
In a recent project I had to create a Singleton class and after a
I got a simple question about jquery fancybox. In my recent project I have
I'm a programming student in my first C++ class, and for a recent project
In a recent project, I built my own MVC framework in PHP. One of
In a recent project I have nearly completed we used an architecture that as
Whilst working on a recent project, I was visited by a customer QA representitive,
In a recent project the lead developer designed a database schema where larger tables
There is another recent Project Euler question but I think this is a bit
On a recent project I have been working on in C#/ASP.NET I have some

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.