From d804e5c3627b1ed387f32027c534a6311d8a95c0 Mon Sep 17 00:00:00 2001 From: exyi Date: Wed, 10 Apr 2019 20:27:09 +0000 Subject: [PATCH] Added error message for DataPager when Visible is set --- src/DotVVM.Framework/Controls/DataPager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DotVVM.Framework/Controls/DataPager.cs b/src/DotVVM.Framework/Controls/DataPager.cs index bb5827eeee..6ccb52dacf 100644 --- a/src/DotVVM.Framework/Controls/DataPager.cs +++ b/src/DotVVM.Framework/Controls/DataPager.cs @@ -8,6 +8,7 @@ using DotVVM.Framework.Compilation.ControlTree; using DotVVM.Framework.Configuration; using Microsoft.Extensions.DependencyInjection; +using System; namespace DotVVM.Framework.Controls { @@ -272,6 +273,8 @@ protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequest // If Visible property was set to something, it will be overwritten by this. TODO: is it how it should behave? if (HideWhenOnlyOnePage) { + if (IsPropertySet(VisibleProperty)) + throw new Exception("Visible can't be set on a DataPager when HideWhenOnlyOnePage is true. You can wrap it in an element that hide that or set HideWhenOnlyOnePage to false"); writer.AddKnockoutDataBind("visible", $"ko.unwrap({GetDataSetBinding().GetKnockoutBindingExpression(this)}).PagingOptions().PagesCount() > 1"); } }