Is there a better way to implement a dropdown list in MVC3 that looks like the one in this HTML/JS example?
I attempted to achieve this using the following code:
Model:
public enum Operator
{
GreaterThan = '>',
LessThan = '<',
Equal = '='
}
public Operator SelectedOperator { get; set; }
View Model:
@Html.DropDownListFor(model => model.SelectedOperator, new SelectList(Enum.GetValues(typeof(YourNamespace.Models.Operator))))
View:
@Html.EditorFor(x => x.AdvanceSearchModel)
While this gave me a basic dropdown list with "Greater Than," "Less Than," and "Equal," I am unsure how to display "<," ">,=" in the dropdown list. Any suggestions?