protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequestContext context) { base.AddAttributesToRender(writer, context); var expression = KnockoutHelper.GetValidationTargetExpression(this); if (expression == null) { return; } var group = new KnockoutBindingGroup(); { group.Add("target", expression); group.Add("includeErrorsFromChildren", IncludeErrorsFromChildren.ToString().ToLower()); group.Add("includeErrorsFromTarget", IncludeErrorsFromTarget.ToString().ToLower()); group.Add("hideWhenValid", HideWhenValid.ToString().ToLower()); } writer.AddKnockoutDataBind("dotvvm-validationSummary", group); if (HideWhenValid) { writer.AddStyleAttribute("display", "none"); } }
/// <summary> /// Adds all attributes that should be added to the control begin tag. /// </summary> protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequestContext context) { var expression = KnockoutHelper.GetValidationTargetExpression(this); if (expression != null) { writer.AddKnockoutDataBind("foreach", $"dotvvm.validation.getValidationErrors({expression}, " + $"{IncludeErrorsFromChildren.ToString().ToLower()}, {IncludeErrorsFromTarget.ToString().ToLower()})"); } base.AddAttributesToRender(writer, context); }