Completed
Last Updated: 22 Jul 2014 13:13 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 17 Jul 2014 12:07
Category: GridView
Type: Bug Report
0
FIX. RadGridView - Current page is not refreshed correctly when you filter the RadGridView.DataSource and PageIndex > TotalPages
To reproduce:
1. Add a RadGridView and a RadButton.
2. Enable paging.
3. Use the code snippet below: 
private void Form1_Load(object sender, EventArgs e)
{
    this.ordersTableAdapter.Fill(this.nwindDataSet.Orders);

    bs.DataSource = this.ordersBindingSource;
    this.radGridView1.DataSource = bs;
}
BindingSource bs = new BindingSource();

private void radButton1_Click(object sender, EventArgs e)
{
    bs.Filter ="ShipName LIKE '%z%'";
}
4. Navigate to page 80 and click the button.
5. You have only 4 pages available , but you are still positioned on page 80.

Workaround:
private void radButton1_Click(object sender, EventArgs e)
{
    bs.Filter ="ShipName LIKE '%z%'";
    if (this.radGridView1.MasterTemplate.PageIndex>this.radGridView1.MasterTemplate.TotalPages)
    {
        this.radGridView1.MasterTemplate.MoveToFirstPage();
    }
}

0 comments