I have applied a dropdown list in MVC and there is an essential feature in the dropdown parameter, here's the design:
@ html.ValidationMessageFor (x => x.loanTypeId, "new", {@class = "errorText arrow_box"}) @html. Dropdown ListFor (x = & gt; x.loanTypeId, Model.loanTypes, "- Select Loan Type -" New, {@ Class = "Selector Select Source Loan Type Class", onchange = "onLoanTypeHelocChange (this)"})
This is my visual model property:
[Required (error message = "Please select the loan type")] {Receive public string loan pattern; Set; } Public listing & lt; SelectListItem & gt; Loan type {get; Set; }
If I change the value of the default option or "select loan type" to any random value by firebug or any other developer console, then my verification fails.
How do I verify this case?
I can check for validity from the server that the value is valid .. but is there any other common approach that can be used for all dropdowns in my application?
Do these files add to your scope?
& lt; Script src = "~ / scripts / jquery.validate.js" & gt; & Lt; / Script & gt; & Lt; Script src = "~ / script / jquery.validate.unobtrusive.js" & gt; & Lt; / Script & gt;
No comments:
Post a Comment