ASP.net MVC Using view models in different views

Posted by Azhar Rana on Stack Overflow See other posts from Stack Overflow or by Azhar Rana
Published on 2012-04-01T11:26:19Z Indexed on 2012/04/01 11:29 UTC
Read the original article Hit count: 174

Filed under:
|
|
|

i have 2 customer views one for create and one for edit. i am using the same Customer view model for both. i want to make the 'customer no field' required on the add but not the edit.

if i put the requiredfield attribute on the view model property then both views flag 'Customer No' as required (as you would expect).

Is there a built in solution to get around this problem or am i going to have to create 2 seperate view models, one with the attribute and one without.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET