In my application , i am using clienside validation to validate particular controls which are rendered from partial view.Partial view coding :
<fieldset>
<div>
<div>
<%= Html.LabelFor(model => model.OrderID) %>
</div>
<div class="editor-field">
<%=Html.DisplayFor(model => model.OrderID)%>
<%= Html.TextBoxFor(model => model.OrderID) %>
<%= Html.ValidationMessageFor(model => model.OrderID) %>
</div>
</div>
<fieldset>
After rendering this partial view . i added this with form.
Its not working properly(didnot display error message) when the controls are render in partial view.
Then i render this control in normal view its working fine.
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true">
After i set UnobtrusiveJavaScriptEnabled is false . then i put my control in partial . now its working. but it is not proper way.i want to do it in proper way .
Any idea about this.
sorry i forgot one thing when i was using html begin form in inside partial view with UnobtrusiveJavaScriptEnabled= true . that time also it working.
Make sure your field is inside a form because validation messages don’t render if the field is not inside a form.
If it is not the reason, show us the validation attribute you’re using for this field.
Edit: Maybe obvious, but check that the unobstrusive .js scripts are being loaded. Put the link right in the place that the fields are being validated to confirm it.
Edit 2: Look at the generated html code. Check if the validation messages are beging generated or not. The Rick Anderson idea also seems to be a good starting point in order to find the problem.