jquery - Remove Unobtrusive validation for Perticuler Control in MVC3 -


i have implemented 1 simple mvc3 application in have used unobtrusivejavascript validation. have 1 drop-down in view don't want validate it. event have not put validation in viewmodel.

viewmodel

public class tutoraddressviewmodel     {          public tutoraddressviewmodel()         {                        addresstype = new list<selectlistitem>();         }         public list<selectlistitem> addresstype {get;set;}          public byte typeid { get; set; }  } 

view

<table style="background: none; " class="addressdetail">     <tr>         <td>             @html.dropdownlistfor(m => m.typeid,model.addresstype  , new { @style = "width:150px;" })         </td> </tr> </table> 

this address type dropdown don't want validate, when have set unobtrusivejavascriptenabled property false in web config work fine means not validate control when have set true not allow me post form when addresstype empty.

so how can remove unobtrusivejava validation particulater control?

setting unobtrusivejavascript false in web config disable unobtrusive validations globally.

if using data annotations can decide validation flow property want validate. because data annotations , unobtrusive js validations work side side in way.

so advise use data annotations structure validate modal properties.

//do not put attribute if not want validate it! public list<selectlistitem> addresstype {get;set;}  public byte typeid { get; set; } 

if don't want unobtrusive validation fire on property, not use data annotation attribute on property in case.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -