I am trying to make a select for the Title prop with a choice of options or with the input of an arbitrary value. Created a simple model:
public class Email { public int Id { get; set; } public string Title { get; set; } public string Message { get; set; } } I display it on the view:
@Html.LabelFor(model => model.Title , "Title") @Html.DropDownListFor(model => model.Title, new SelectList(new string[] { "Title 1", "Title 2", "Title 3"})) @Html.LabelFor(model => model.Message , "Message") @Html.EditorFor(model => model.Message) In fact, with the choice of options, everything is fine, but I won’t put my mind on how to set an arbitrary text for this field, since select disables the entry of values not in the select list.
Actually the question: how to make Select (DropDownListFor) with the ability to enter an arbitrary value?