diff --git a/src/Framework/Framework/Controls/DataPager.cs b/src/Framework/Framework/Controls/DataPager.cs index 8a300df463..78e4cab921 100644 --- a/src/Framework/Framework/Controls/DataPager.cs +++ b/src/Framework/Framework/Controls/DataPager.cs @@ -193,10 +193,18 @@ protected virtual void DataBind(Hosting.IDotvvmRequestContext context) // li.SetBinding(DataContextProperty, GetNearIndexesBinding(context, i, dataContextType)); liTemplate.CssClasses.Add(ActiveItemCssClass, new ValueOrBinding(pagerBindings.IsActivePage.NotNull())); var link = new LinkButton(); - link.SetBinding(ButtonBase.ClickProperty, pagerBindings.GoToPage!); - link.SetBinding(ButtonBase.TextProperty, pagerBindings.PageNumberText); + link.SetBinding(ButtonBase.ClickProperty, pagerBindings.GoToPage.NotNull()); + link.SetBinding(ButtonBase.TextProperty, pagerBindings.PageNumberText.NotNull()); if (!true.Equals(enabled)) link.SetValue(LinkButton.EnabledProperty, enabled); liTemplate.Children.Add(link); + if (!this.RenderLinkForCurrentPage) + { + var notLink = new Literal(pagerBindings.PageNumberText); + notLink.RenderSpanElement = true; + notLink.SetBinding(DotvvmControl.IncludeInPageProperty, pagerBindings.IsActivePage); + link.SetBinding(DotvvmControl.IncludeInPageProperty, pagerBindings.IsActivePage.Negate()); + liTemplate.Children.Add(notLink); + } NumberButtonsRepeater = new Repeater() { DataSource = pagerBindings.PageNumbers, RenderWrapperTag = false, diff --git a/src/Samples/Common/ViewModels/ControlSamples/GridView/GridViewStaticCommandViewModel.cs b/src/Samples/Common/ViewModels/ControlSamples/GridView/GridViewStaticCommandViewModel.cs index d9157dd373..0d59bd12f7 100644 --- a/src/Samples/Common/ViewModels/ControlSamples/GridView/GridViewStaticCommandViewModel.cs +++ b/src/Samples/Common/ViewModels/ControlSamples/GridView/GridViewStaticCommandViewModel.cs @@ -55,7 +55,7 @@ public override Task PreRender() } [AllowStaticCommand] - public async Task> LoadStandard(GridViewDataSetOptions options) + public static async Task> LoadStandard(GridViewDataSetOptions options) { var dataSet = new GridViewDataSet(); dataSet.ApplyOptions(options); @@ -64,7 +64,7 @@ public async Task> LoadStandard(GridViewDataSetOpt } [AllowStaticCommand] - public async Task LoadToken(GridViewDataSetOptions options) + public static async Task LoadToken(GridViewDataSetOptions options) { var dataSet = new NextTokenGridViewDataSet(); dataSet.ApplyOptions(options); @@ -73,7 +73,7 @@ public async Task LoadToken(GridViewDataSetOptions LoadTokenHistory(GridViewDataSetOptions options) + public static async Task LoadTokenHistory(GridViewDataSetOptions options) { var dataSet = new NextTokenHistoryGridViewDataSet(); dataSet.ApplyOptions(options); @@ -82,7 +82,7 @@ public async Task LoadTokenHistory(GridViewData } [AllowStaticCommand] - public async Task LoadMultiSort(GridViewDataSetOptions options) + public static async Task LoadMultiSort(GridViewDataSetOptions options) { var dataSet = new MultiSortGridViewDataSet(); dataSet.ApplyOptions(options); diff --git a/src/Samples/Common/Views/ControlSamples/GridView/GridViewStaticCommand.dothtml b/src/Samples/Common/Views/ControlSamples/GridView/GridViewStaticCommand.dothtml index 61d7488c99..c1c7bd0e4e 100644 --- a/src/Samples/Common/Views/ControlSamples/GridView/GridViewStaticCommand.dothtml +++ b/src/Samples/Common/Views/ControlSamples/GridView/GridViewStaticCommand.dothtml @@ -18,7 +18,7 @@ - + <%--

NextToken paging options

- +

NextTokenHistory data set

+ <%--LoadData="{staticCommand: RootViewModel.LoadTokenHistory}"--%> > @@ -44,11 +44,11 @@ - +

MultiSort data set

+ <%--LoadData="{staticCommand: RootViewModel.LoadMultiSort}"--%> > @@ -57,7 +57,7 @@ - + --%> diff --git a/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html b/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html index 83586b2722..7f541e0b71 100644 --- a/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html +++ b/src/Tests/ControlTests/testoutputs/DataPagerTests.CommandDataPager.html @@ -10,7 +10,12 @@
  • + + + + +