Hi, I'm using xVal for client-side validation, I have the following code:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Models.FiltersModel>" %>
<%@ Import Namespace="xVal.Rules" %>
<%@ Import Namespace="xVal.Html" %>
<% using( Html.BeginForm() ) { %>
<div id="filter-name-area">
<%: Html.LabelFor( x => x.Name )%>
<%: Html.TextBoxFor( x => x.Name, new { @class = "text" } )%>
<%-- <%: Html.ValidationMessageFor(x => x.Name) %> --%>
<button id="filters-add-row" style="float: right"></button>
</div>
<%} %>
<%= Html.ClientSideValidation<Models.FiltersModel>()%>
And this is my view model:
public class FiltersModel {
[Required]
[DisplayName( "Name:" )]
public string Name { get; set; }
}
Whether I comment <%: Html.ValidationMessageFor(x => x.Name) %>
or not, I still get the validation message.
How come?
Thanks for your help.