Hi all,
Just wondered if anybody could tell me why when doing custom paging the CurrentPageIndex of the grid is always equal to 0 no matter which page I click? Am I missing something really obvious?
I have my grid set up as follows and am only doing paging no sorting/grouping etc:
AllowPaging = true
AllowCustomPaging =true
PageSize=20
OnNeedDataSource=grid1_NeedDataSource
My code behind gets the name of a user entered into a search box txtName and then uses this as search criteria. If CurrentPageIndex is 0 I set it to 1 as that is what my sproc needs as a minimum startRowIndex. But whenever I debug and select a different page the grid1.MasterTableView.CurrentPageIndex property is always 0 and never changes.
Any help with this would be much appreciated as its starting to drive me a little insane.
Thanks
Tim
Just wondered if anybody could tell me why when doing custom paging the CurrentPageIndex of the grid is always equal to 0 no matter which page I click? Am I missing something really obvious?
I have my grid set up as follows and am only doing paging no sorting/grouping etc:
AllowPaging = true
AllowCustomPaging =true
PageSize=20
OnNeedDataSource=grid1_NeedDataSource
My code behind gets the name of a user entered into a search box txtName and then uses this as search criteria. If CurrentPageIndex is 0 I set it to 1 as that is what my sproc needs as a minimum startRowIndex. But whenever I debug and select a different page the grid1.MasterTableView.CurrentPageIndex property is always 0 and never changes.
protected void grid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
{ |
String name = txtName.Text.Trim(); |
Int32 totalRecords; |
Int32 startRowIndex = grid1.MasterTableView.CurrentPageIndex == 0 ? 1 : grid1.MasterTableView.CurrentPageIndex * grid1.PageSize; |
Int32 maximumRows = grid1.MasterTableView.PageSize; |
if (name != String.Empty) |
{ |
UserCollection users = UserMgr.GetByUserSearch(name, startRowIndex, maximumRows, out totalRecords); |
grid1.VirtualItemCount = totalRecords; |
grid1.DataSource = users; |
} |
} |
Any help with this would be much appreciated as its starting to drive me a little insane.
Thanks
Tim