public override void Process(TagHelperContext context, TagHelperOutput output) { bool displayIfValueDoesNotMatch = !ValueMatches() && !this.DisplayIfHasValue && this.DisplayIfNotValue == null; bool displayIfNotValueMatches = ValueNotMatches(); bool displayIfDoesNotHaveValue = this.DisplayIfHasValue && String.IsNullOrWhiteSpace(this.DisplayIf.Model?.ToString()); if (displayIfValueDoesNotMatch || displayIfNotValueMatches || displayIfDoesNotHaveValue) { output.AddStyle("display: none;"); } if (DisplayIfValue is bool) { DisplayIfValue = ((bool)DisplayIfValue).ToString().ToLower(); } if (DisplayIfNotValue is bool) { DisplayIfNotValue = ((bool)DisplayIfNotValue).ToString().ToLower(); } output.Attributes.Add("data-display-if-name", this.DisplayIf == null ? this.DisplayIfName : this.DisplayIf.Name); output.Attributes.Add("data-display-if-value", this.DisplayIfValue); if (this.DisplayIfNotValue != null) { output.Attributes.Add("data-display-if-not-value", this.DisplayIfNotValue); } output.Attributes.Add("data-display-if-client-evaluate", this.DisplayIfClientEvaluate); output.Attributes.Add("data-display-if-has-value", this.DisplayIfHasValue.ToString().ToLower()); }