@model List @{ var htmlAttributes = ViewData["htmlAttributes"] as Dictionary ?? new(); htmlAttributes.TryAdd("class", "form-control select2"); htmlAttributes.TryAdd("style", "width: 100%;"); htmlAttributes.TryAdd("data-dropdown-css-class", "select2-blue"); htmlAttributes.TryAdd("multiple", "multiple"); }
@Html.ListBox("", ViewData["SelectList"] as IEnumerable, htmlAttributes)