Select tag helper items refactoring part 2

pull/279/head
yekalkan 7 years ago
parent 9bfbf9da03
commit 0b800881e3

@ -32,22 +32,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
var selectItems = (properties.First().Model as IEnumerable<SelectListItem>).ToList();
SetSelectedValue(selectedValue, selectItems);
return selectItems;
}
private static void SetSelectedValue(string selectedValue, List<SelectListItem> selectItems)
{
if (!selectItems.Any(si => si.Selected))
{
var itemToBeSelected = selectItems.FirstOrDefault(si => si.Value.ToString() == selectedValue);
if (itemToBeSelected != null)
{
itemToBeSelected.Selected = true;
}
}
}
}
}

Loading…
Cancel
Save