How to do conditional required field validations in ASP.net MVC2 -
i have 2 , 1 update user details change password panel. both has separate "update" button. don't want user details part validated when click on update button of change password , vice versa applies same. presently using following code in view.
[required] [datatype(datatype.password)] [displaynamelocalized(typeof(capnorresource), "repeatnewpassword")] public string repeatnewpassword { get; set; }
in ui following code.
<div class="passwordtd"> <%: html.labelfor(view => view.repeatnewpassword)%> <%: html.passwordfor(view => view.repeatnewpassword)%> <%: html.validationmessagefor(view => view.repeatnewpassword)%> </div>
i'm not quite sure wording of question, 2 different buttons, sounds 2 different forms 2 different viewmodels. viewmodels make 1 large viewmodel, or use renderpartial separate them completely.
Comments
Post a Comment