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


C# TagHelperOutput.SuppressOutput方法代码示例

本文整理汇总了C#中Microsoft.AspNet.Razor.TagHelpers.TagHelperOutput.SuppressOutput方法的典型用法代码示例。如果您正苦于以下问题:C# TagHelperOutput.SuppressOutput方法的具体用法?C# TagHelperOutput.SuppressOutput怎么用?C# TagHelperOutput.SuppressOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.AspNet.Razor.TagHelpers.TagHelperOutput的用法示例。


在下文中一共展示了TagHelperOutput.SuppressOutput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessAsync

 public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
 {
     var childContent = await output.GetChildContentAsync();
     var modalContext = (ModalContext)context.Items[typeof(ModalTagHelper)];
     modalContext.Body = childContent;
     output.SuppressOutput();
 }
开发者ID:candoumbe,项目名称:TagHelperSamples,代码行数:7,代码来源:ModalBodyTagHelper.cs

示例2: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            //if no scripts were added, suppress the contents
            if (!_httpContextAccessor.HttpContext.Items.ContainsKey(InlineScriptConcatenatorTagHelper.ViewDataKey))
            {
                output.SuppressOutput();
                return;
            }

            //Otherwise get all the scripts for the page
            var scripts =
                _httpContextAccessor.HttpContext.Items[InlineScriptConcatenatorTagHelper.ViewDataKey] as
                    IDictionary<string, NamedScriptInfo>;
            if (null == scripts)
            {
                output.SuppressOutput();
                return;
            }

            //Concatenate all of them and set them as the contents of this tag
            var allScripts = string.Join("\r\n", OrderedScripts(scripts.Values).Select(os => os.Script));
            output.TagMode = TagMode.StartTagAndEndTag;
            //HACK:Need to figure out how to get rid of the script tags for the placeholder element
            allScripts = $"</script><!--Rendered Scripts Output START-->\r\n{allScripts}\r\n</script><!--Rendered Scripts Output END--><script>";//HACK:ugly
            var unminifiedContent = output.Content.SetHtmlContent(allScripts);
            Debug.WriteLine(unminifiedContent.GetContent());
            //TODO:Impliment dynamic minification (Assuming that some scenarios will be sped up, and others slowed down.  Leave choice to user)
        }
开发者ID:SvdSinner,项目名称:ScriptManagerPlus,代码行数:28,代码来源:InlineScriptTagHelper.cs

示例3: Process

 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     if (ShowIfNull != null)
     {
         output.SuppressOutput();
     }
 }
开发者ID:pugillum,项目名称:AspNet5IdentityServerAngularImplicitFlow,代码行数:7,代码来源:HideShowTagHelpers.cs

示例4: Process

 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     if (HideIf)
     {
         output.SuppressOutput();
     }
 }
开发者ID:RR-Studio,项目名称:RealEstateCrm,代码行数:7,代码来源:HideTagHelper.cs

示例5: Process

 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     // If a condition is set and evaluates to false, don't render the tag.
     if (Condition.HasValue && !Condition.Value)
     {
         output.SuppressOutput();
     }
 }
开发者ID:huoxudong125,项目名称:Mvc,代码行数:8,代码来源:ConditionTagHelper.cs

示例6: BootstrapProcess

 protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
     if (ListGroupContext.ChildDetectionMode) {
         ListGroupContext.RenderAsDiv = true;
         output.SuppressOutput();
     }
     else
         RenderOutput(output);
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:8,代码来源:ListGroupLinkTagHelper.cs

示例7: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.Attributes.RemoveAll(MARKER_ATTRIBUTE);
            var tagHelperOutput = new TagHelperOutput(output.TagName, output.Attributes, output.GetChildContentAsync);

            _manager.Scripts.Add(tagHelperOutput);
            output.SuppressOutput();
        }
开发者ID:glennc,项目名称:ScriptManager,代码行数:8,代码来源:ScriptTag.cs

示例8: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (this.ViewContext == null || this.For == null)
            return;

              output.SuppressOutput();
              output.Content.Clear();
              output.Content.Append(this.GenerateInput(this.ViewContext, this.For, null, "password"));
        }
开发者ID:rajendra1809,项目名称:Platformus,代码行数:9,代码来源:PasswordBoxTagHelper.cs

示例9: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (this.ViewContext == null || this.For == null || this.Options == null)
            return;

              output.SuppressOutput();
              output.Content.Clear();
              output.Content.Append(this.GenerateField());
        }
开发者ID:rajendra1809,项目名称:Platformus,代码行数:9,代码来源:DropDownListSelectorTagHelper.cs

示例10: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (ViewContext.HttpContext.User.Identity.IsAuthenticated && ViewContext.HttpContext.User.IsInRole(Role))
            {
                base.Process(context, output);
                return;
            }

            output.SuppressOutput();
        }
开发者ID:cecilphillip,项目名称:codecamp-organizer-demo,代码行数:10,代码来源:SecureTagHelper.cs

示例11: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (ViewContext.HttpContext.User.Identity.IsAuthenticated && ViewContext.HttpContext.User.IsInRole(Role))
            {
                base.Process(context, output);
                return;
            }

            output.SuppressOutput();
            output.Content.Append("<h3>You must login first</h3>");
        }
开发者ID:cecilphillip,项目名称:aspnet-codeonthebeach-2015,代码行数:11,代码来源:SecureTagHelper.cs

示例12: ProcessAsync

 public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
 {
     var result = await AngularRenderer.RenderToString(
         nodeServices: this.nodeServices,
         componentModuleName: this.ModuleName,
         componentExportName: this.ExportName,
         componentTagName: output.TagName,
         requestUrl: UriHelper.GetEncodedUrl(this.contextAccessor.HttpContext.Request)
     );
     output.SuppressOutput();
     output.PostElement.AppendHtml(result);
 }
开发者ID:leloulight,项目名称:NodeServices,代码行数:12,代码来源:AngularPrerenderTagHelper.cs

示例13: ProcessAsync

        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            if (!string.IsNullOrEmpty(Policy))
            {
                var canSee = await authorizationService.AuthorizeAsync(HttpContextAccessor.HttpContext.User, Policy);
                if (!canSee)
                {
                    output.SuppressOutput();
                }
            }

        }
开发者ID:freemsly,项目名称:MVC6-Awakens,代码行数:12,代码来源:SecurityTrimmingTagHelper.cs

示例14: Process

 public override void Process(TagHelperContext context, TagHelperOutput output)
 {
     var varVal = Environment.GetEnvironmentVariable("Hosting:Environment");
     if (varVal == NamesValue || (string.IsNullOrEmpty(NamesValue) && string.IsNullOrEmpty(varVal)))
     {
         var childContent = output.GetChildContentAsync().Result;
         output.Content.AppendHtml(childContent.GetContent());
     }
     else
     {
         output.SuppressOutput();
     }
 }
开发者ID:gene9,项目名称:aspnet-windows-service,代码行数:13,代码来源:EnvTagHelper.cs

示例15: ProcessAsync

        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            string url = await GetGiphyUrl(_config.ApiKey, SearchTerm);

            if (string.IsNullOrWhiteSpace(url))
            {
                output.SuppressOutput();
            } else
            {
                output.TagName = "img";
                output.TagMode = TagMode.SelfClosing;
                output.Attributes["src"] = url;
            }
        }
开发者ID:bigfont,项目名称:asp-net-core-vnow,代码行数:14,代码来源:GiphyTagHelper.cs


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