Completed
Last Updated: 03 Feb 2022 08:04 by ADMIN
Release R1 2022 SP1
Hristo
Created on: 20 Dec 2021 10:05
Category: UI for WinForms
Type: Bug Report
0
RadGridView: The First/Last page navigation should be disabled when the First/Last page is current

Currently the Enabled state of the buttons is not updated: 

With this setup it is expected that the First/Previous and FastBack buttons are disabled. The same is also valid with the Last/Next and FastForward buttons when the last page is current.

A possible workaround is to handle the ViewChanged event of the template and manage the Enabled state of the buttons. Just make sure that the event is subscribed before enabling the paging: 

this.radGridView1.MasterTemplate.ViewChanged += this.MasterTemplate_ViewChanged;
this.radGridView1.EnablePaging = true;
private void MasterTemplate_ViewChanged(object sender, DataViewChangedEventArgs args)
{
    this.radGridView1.GridViewElement.PagingPanelElement.FirstButton.Enabled = true;
    this.radGridView1.GridViewElement.PagingPanelElement.PreviousButton.Enabled = true;
    this.radGridView1.GridViewElement.PagingPanelElement.FastBackButton.Enabled = true;

    this.radGridView1.GridViewElement.PagingPanelElement.LastButton.Enabled = true;
    this.radGridView1.GridViewElement.PagingPanelElement.NextButton.Enabled = true;
    this.radGridView1.GridViewElement.PagingPanelElement.FastForwardButton.Enabled = true;

    if (this.radGridView1.MasterTemplate.PageIndex == 0)
    {
        this.radGridView1.GridViewElement.PagingPanelElement.FirstButton.Enabled = false;
        this.radGridView1.GridViewElement.PagingPanelElement.PreviousButton.Enabled = false;
        this.radGridView1.GridViewElement.PagingPanelElement.FastBackButton.Enabled = false;
    }
    else if(this.radGridView1.MasterTemplate.PageIndex == this.radGridView1.MasterTemplate.TotalPages - 1)
    {
        this.radGridView1.GridViewElement.PagingPanelElement.LastButton.Enabled = false;
        this.radGridView1.GridViewElement.PagingPanelElement.NextButton.Enabled = false;
        this.radGridView1.GridViewElement.PagingPanelElement.FastForwardButton.Enabled = false;
    }
}

0 comments