I have a Target field in my PopupEditor that's using custom List to display a dropdown in the View. I want the first item in the custom list (Self) to show as the default value in the dropdown.
View:
@Html.LabelFor(model => model.Target, new { @class = "col-sm-5 control-label" })<div> @Html.EditorFor(model => model.Target)</div>Controller:
public ActionResult Index(){ ViewData["Targets"] = ixList.Targets(); return View();}Custom List (ixList):
public static List<TargetsModel> Targets(){ List<TargetsModel> targets = new List<TargetsModel>(); targets.Add(new TargetsModel { Description = "Self", Target = "_self" }); targets.Add(new TargetsModel { Description = "Blank", Target = "_blank" }); return targets;}Model:
[UIHint("GridForeignKey")]public string Target { get; set; } // target = _blank, _self
How would I go about setting the first item Self to the default value? Right now the default value appears to be null.