Last post Jan 31, 2013 08:32 PM by thaicarrot
Jan 30, 2013 05:21 AM|orimaspnet|LINK
i have a property FirstName in metadata class. I only want to set the "Required" Attributte to true if i select "Standard" in my Dropdownlist-Type - else not required.
Can i achieve this in on FirstNameChanging or FirstNameChanged. Can someone point me in the right direction.
Jan 31, 2013 08:27 PM|Decker Dong - MSFT|LINK
Please do this event on FirstNameChanging to check your SelectedValue.
And it would be better if you can define a customized Attribute to entitle which property you wanna do validation:
Jan 31, 2013 08:32 PM|thaicarrot|LINK
ASP.NET MVC supports client-side validation of data by sharing validation information from the server. This is done by implementing the
IClientValidatable interface on your custom validation classes. IClientValidatable contains only the
GetClientValidationRules method that returns a ModelClientValidationRule