So right now on my form when I type a username in this text box. I have set up remote validation on this textbox.
So when this @Html.ValidationMessageFor(model => model.UserName) validation runs after I type in a user name, the validation checks my sql server table for that column. If the same username already exists in my table then the a message that says "user already exists" appears on my page in red font , right next to this textbox.
@(Html.Kendo().AutoComplete()
.Name("UsersAC")
.DataTextField("UserName")
.MinLength(3)
.HtmlAttributes(new { style = "width:450px" })
.Placeholder("Type a ship name")
.Template("#= OrderID # | For: #= ShipName #, #= ShipCountry #")
.DataSource(source => {
source.Custom()
.ServerFiltering(true)
.ServerPaging(true)
.Type("aspnetmvc-ajax") //Set this type if you want to use DataSourceRequest and ToDataSourceResult instances
.Transport(transport =>
{
transport.Read("Virtualization_Read", "AutoComplete");
})
.Schema(schema =>
{
schema.Data("Data") //define the [data](http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data) option
.Total("Total"); //define the [total](http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.total) option
});
})
.Virtual(true)
)
So if I replace my textbox with this autocomplete does anyone know how I apply this validation @Html.ValidationMessageFor(model => model.UserName) to my autocomplete?