MVC shared model different required fields on different type
Posted
by
kurasa
on Programmers
See other posts from Programmers
or by kurasa
Published on 2013-04-27T03:19:22Z
Indexed on
2013/06/26
10:28 UTC
Read the original article
Hit count: 256
mvc
I have a model called Car and depending on what type of Car the user select the view is presented differently. For example the user selects from a grid of different cars and depending if it is a Volvo or a Kia or a Ford the view must allow different fields to be editable. For example with a Volvo the color is editable and is mandatory but with a Kia it is not.
I would like to use the one Car class to bind the view but want the client side validation to pick up the required fields based on what type of car.
I want to go only to one Action method for the Update
what is a good way to approach this problem...? create a base class and inherit from it? will this give me binding problems..?
© Programmers or respective owner