This is a migrated thread and some comments may be shown as answers.

Paging stuck on nonexistent page after Rebind()

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zdeněk
Top achievements
Rank 1
Zdeněk asked on 31 Mar 2010, 04:28 PM
Hi,
I have problem with paging in ASP.NET AJAX RadGrid (2009.1). When radgrid is not on first page and I call Rebind() with some narrowing query (result is only one page of records), RadGrid will stuck on non-existent page (eg. Page 11 of 1, Items 110 of 1, Total records 1) and shows NoMasterRecords message.

I must press "go to first page" and then RadGrid starts work correctly. I tried to set RadGrid1.MasterTableView.CurrentPageIndex = 0 after Rebind, but with no luck.

Can you help me? Thank you.

Zdenek

Protected Sub RadToolBar1_ButtonClick(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick 
 
            Case "search"                     
                    RadGrid1.Rebind() 
                    RadGrid1.MasterTableView.CurrentPageIndex = 0 
 End Select 
 
End Sub 
 
Protected Sub ldsLocality_Selecting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles ldsLocality.Selecting 
 
 
            Dim myLocalities = From loc In dc.Localities Order By loc.Customer.Name, loc.Name Select loc 
 
            'Search 
            Dim serachString As String = String.Empty 
            Dim searchTextBox As RadTextBox = CType(CType(RadToolBar1.FindButtonByCommandName("searchText"), RadToolBarButton).FindControl("txtSearch"), RadTextBox) 
            If searchTextBox IsNot Nothing AndAlso searchTextBox.Text <> String.Empty Then 
                myLocalities = myLocalities.Where(Function(q) _ 
                                                q.CustomerID.ToString.Contains(searchTextBox.Text.Trim) Or _ 
                                                q.Comment.Contains(searchTextBox.Text.Trim) Or _ 
                                                q.Comment2.Contains(searchTextBox.Text.Trim) Or _ 
                                                q.Name.Contains(searchTextBox.Text.Trim)) 
            End If 
 
            e.Result = myLocalities 
        End Sub 

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 06 Apr 2010, 11:43 AM
Hello Zdenek,

You need to set the current page index to 0 before the call to the grid's Rebind() method.

I hope this helps.

Regards,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Zdeněk
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or