I have an editor template for DropDownLists that is marked with an attribute like this:
[AttributeUsage(AttributeTargets.Property)]
public class DropDownListAttribute : UIHintAttribute
{
public string SelectListName { get; set; }
public DropDownListAttribute(string selectListName)
: base("DropDownList", "MVC", selectListName)
{
SelectListName = selectListName;
}
}
And itself looks like this:
@using Comair.RI.UI.Core
@{
var list = this.GetModelSelectList();
var listWithSelected = new SelectList(list.Items, list.DataValueField, list.DataTextField, Model);
}
@Html.DropDownListFor(m => Model, listWithSelected, " - select - ")
My issue here is it only validates server side, which is very annoying for a user to resolve all client side validations, only to submit and get a new, surprise server side validation.