本文整理汇总了C#中Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput.AppendClass方法的典型用法代码示例。如果您正苦于以下问题:C# TagHelperOutput.AppendClass方法的具体用法?C# TagHelperOutput.AppendClass怎么用?C# TagHelperOutput.AppendClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput
的用法示例。
在下文中一共展示了TagHelperOutput.AppendClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public override async void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "div";
output.AppendClass("widget-box");
output.AppendClass(Class);
var originalContent = await output.GetChildContentAsync();
var innerHtml = originalContent.GetContent();
output.Content.Clear();
if (!innerHtml.Contains(WidgetBoxHeaderHelper.HeaderCss))
{
// user is taking easy/lazy way of declaring the widget box
output.Content.AppendHtml(WidgetBoxHeaderHelper.GetFullHeader(Title, IsCollapsible));
var widgetBodyDiv = WidgetBoxBodyHelper.GetFullBodyInternals(Padding, innerHtml);
output.Content.AppendHtml(widgetBodyDiv);
}
else
{
// user is doing the hardwork themselves
output.Content.AppendHtml(innerHtml);
}
base.Process(context, output);
}
示例2: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "input";
output.AppendClass(Class);
output.AppendClass("form-control");
output.Attributes.Add("type", TextBoxType);
base.Process(context, output);
}
示例3: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "select";
output.TagMode = TagMode.StartTagAndEndTag;
output.AppendClass("form-control");
var optionsList = new List<TagBuilder>();
if (Items == null)
{
Items = new List<SelectListItem>();
}
foreach (var item in Items)
{
var option = new TagBuilder("option");
option.Attributes.Add("value", item.Value);
option.InnerHtml.Append(item.Text);
optionsList.Add(option);
}
optionsList.ForEach(o =>
{
output.Content.AppendHtml(o);
});
base.Process(context, output);
}
示例4: Process
public override async void Process(TagHelperContext context, TagHelperOutput output)
{
var originalContent = await output.GetChildContentAsync();
output.AppendClass("form-group");
TagBuilder labelBuilder = null;
if (!originalContent.GetContent().Contains("<label"))
{
labelBuilder = FormGroupLabel.Get(Horizontal, LabelText);
}
var contentDiv = new TagBuilder("div");
if (Horizontal)
{
contentDiv.AddCssClass("col-sm-8");
}
contentDiv.InnerHtml.AppendHtml(originalContent.GetContent());
output.TagName = "div";
output.Content.Clear();
if (labelBuilder != null)
{
output.Content.AppendHtml(labelBuilder);
}
output.Content.AppendHtml(contentDiv);
base.Process(context, output);
}
示例5: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "textarea";
output.AppendClass("form-control");
base.Process(context, output);
}