本文整理汇总了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();
}
示例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)
}
示例3: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (ShowIfNull != null)
{
output.SuppressOutput();
}
}
示例4: Process
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (HideIf)
{
output.SuppressOutput();
}
}
示例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();
}
}
示例6: BootstrapProcess
protected override void BootstrapProcess(TagHelperContext context, TagHelperOutput output) {
if (ListGroupContext.ChildDetectionMode) {
ListGroupContext.RenderAsDiv = true;
output.SuppressOutput();
}
else
RenderOutput(output);
}
示例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();
}
示例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"));
}
示例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());
}
示例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();
}
示例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>");
}
示例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);
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
}