2

I have a model, which has a field that I don't want it to be validated on client side. Is there a way to turn off the client validation just on the referred field?

Cœur
  • 37,241
  • 25
  • 195
  • 267
viniciusalvess
  • 756
  • 8
  • 18

1 Answers1

0
<div class="editor-field">
    @{ Html.EnableClientValidation(false); }
    @Html.TextBoxFor(m => m.BatchId, new { @class = "k-textbox" })
    @{ Html.EnableClientValidation(true); }
</div>

Answer is from here: ASP .NET MVC Disable Client Side Validation at Per-Field Level

Community
  • 1
  • 1
Bruno Garcia
  • 6,029
  • 3
  • 25
  • 38
  • Thank you @Bruno Garcia that helps a lot. I found out setting the data-val atribute to false works too. But I think your aproach is more clear ! Example I found out : Html.TextBoxFor(model => model.banco.nome, new { class = "form-control", id = "pessoa_banco", placeholder = "Pesquisar...", data_val = false }) – viniciusalvess Feb 04 '16 at 01:05