protected virtual async Task <string> RenderAnchorTagHelperLinkHtmlAsync(TagHelperContext context, TagHelperOutput output, string currentPage, string localizationKey) { var localizer = _tagHelperLocalizer.GetLocalizer(typeof(AbpUiResource)); var anchorTagHelper = GetAnchorTagHelper(currentPage, out var attributeList); var tagHelperOutput = await anchorTagHelper.ProcessAndGetOutputAsync(attributeList, context, "a", TagMode.StartTagAndEndTag).ConfigureAwait(false); tagHelperOutput.Content.SetHtmlContent(localizer[localizationKey]); var renderedHtml = tagHelperOutput.Render(_encoder); return(renderedHtml); }
protected virtual string RenderAnchorTagHelperLinkHtml(TagHelperContext context, TagHelperOutput output, string currentPage, string localizationKey) { var localizer = _tagHelperLocalizer.GetLocalizer(typeof(AbpUiResource)); var anchorTagHelper = GetAnchorTagHelper(currentPage, out var attributeList); var tagHelperOutput = GetInnerTagHelper(attributeList, context, anchorTagHelper, "a", TagMode.StartTagAndEndTag); tagHelperOutput.Content.SetHtmlContent(localizer[localizationKey]); var renderedHtml = RenderTagHelperOutput(tagHelperOutput, _encoder); return(renderedHtml); }
protected virtual List <SelectListItem> GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer) { var localizer = _tagHelperLocalizer.GetLocalizer(explorer); var selectItems = explorer.Metadata.IsEnum ? explorer.ModelType.GetTypeInfo().GetMembers(BindingFlags.Public | BindingFlags.Static) .Select((t, i) => new SelectListItem { Value = i.ToString(), Text = GetLocalizedPropertyName(localizer, explorer.ModelType, t.Name) }).ToList() : null; return(selectItems); }
protected virtual List <SelectListItem> GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer) { var localizer = _tagHelperLocalizer.GetLocalizer(explorer); var selectItems = new List <SelectListItem>(); var isNullableType = Nullable.GetUnderlyingType(explorer.ModelType) != null; var enumType = explorer.ModelType; if (isNullableType) { enumType = Nullable.GetUnderlyingType(explorer.ModelType); selectItems.Add(new SelectListItem()); } selectItems.AddRange(enumType.GetEnumNames() .Select(enumName => new SelectListItem { Value = Convert.ToUInt64(Enum.Parse(enumType, enumName)).ToString(), Text = GetLocalizedPropertyName(localizer, enumType, enumName) })); return(selectItems); }
protected virtual List <SelectListItem> GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer) { var localizer = _tagHelperLocalizer.GetLocalizer(explorer); var selectItems = new List <SelectListItem>(); var isNullableType = Nullable.GetUnderlyingType(explorer.ModelType) != null; var enumType = explorer.ModelType; if (isNullableType) { enumType = Nullable.GetUnderlyingType(explorer.ModelType); selectItems.Add(new SelectListItem()); } selectItems.AddRange(enumType.GetTypeInfo().GetMembers(BindingFlags.Public | BindingFlags.Static) .Select((t, i) => new SelectListItem { Value = ((int)Enum.Parse(enumType, t.Name)).ToString(), Text = GetLocalizedPropertyName(localizer, enumType, t.Name) }).ToList()); return(selectItems); }