Update AbpRadioInputTagHelperService.cs

pull/705/head
Yunus Emre Kalkan 6 years ago
parent 03f1407134
commit 88981b8ca9

@ -76,18 +76,19 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
{
return TagHelper.AspItems.ToList();
}
else if (TagHelper.AspFor.ModelExplorer.Metadata.IsEnum)
if (TagHelper.AspFor.ModelExplorer.Metadata.IsEnum)
{
return GetSelectItemsFromEnum(context, output, TagHelper.AspFor.ModelExplorer);
}
else if (TagHelper.AspFor.ModelExplorer.Metadata.IsEnum)
{
return GetSelectItemsFromAttribute(context, output, TagHelper.AspFor.ModelExplorer);
}
else
var selectItemsAttribute = GetAttribute<SelectItems>(TagHelper.AspFor.ModelExplorer);
if (selectItemsAttribute != null)
{
throw new Exception("No items provided for select attribute.");
return GetSelectItemsFromAttribute(selectItemsAttribute, TagHelper.AspFor.ModelExplorer);
}
throw new Exception("No items provided for select attribute.");
}
protected virtual List<SelectListItem> GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer)
@ -118,15 +119,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
return !localizedString.ResourceNotFound ? localizedString.Value : localizer[propertyName].Value;
}
protected virtual List<SelectListItem> GetSelectItemsFromAttribute(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer)
protected virtual List<SelectListItem> GetSelectItemsFromAttribute(
SelectItems selectItemsAttribute,
ModelExplorer explorer)
{
var selectItemsAttribute = GetAttribute<SelectItems>(explorer);
if (selectItemsAttribute == null)
{
return null;
}
var selectItems = selectItemsAttribute.GetItems(explorer)?.ToList();
if (selectItems == null)

Loading…
Cancel
Save