当前位置: 首页>>代码示例>>C#>>正文


C# TagHelperOutput.AppendClass方法代码示例

本文整理汇总了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);
        }
开发者ID:CormacdeBarra,项目名称:steelcap,代码行数:27,代码来源:WidgetBoxHelper.cs

示例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);
        }
开发者ID:CormacdeBarra,项目名称:steelcap,代码行数:10,代码来源:TextboxTagHelper.cs

示例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);
        }
开发者ID:CormacdeBarra,项目名称:steelcap,代码行数:30,代码来源:DropdownTagHelper.cs

示例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);
        }
开发者ID:CormacdeBarra,项目名称:steelcap,代码行数:31,代码来源:FormGroupTagHelper.cs

示例5: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "textarea";

            output.AppendClass("form-control");

            base.Process(context, output);
        }
开发者ID:CormacdeBarra,项目名称:steelcap,代码行数:8,代码来源:TextareaTagHelper.cs


注:本文中的Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput.AppendClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。