I agree with xixonia, I use a separate view model for searching, but to answer your question you have several options for the client side:
- Go to
data-val = "false" as an HTML attribute, for example: @Html.TextBoxFor(x => x.Age, new { data_val = "false" }); - Use
@Html.TextBox() instead - Manually create your text box using HTML using the same input name so that it binds to the model
If you are performing a check at the back end (you must be!), That is, checking ModelState.IsValid , then you will have to remove the checking properties from ModelState, for example: ModelState.Remove("Age"); .
source share