Hi,
I have one requirement List throttling , I'm bind list data to Grid view through SPQuery , but in that grid view having page navigation. i want each page 100 records . how to set the share point list data to each page 100 items through SPQuery
Technology Tips and News
Hi,
I have one requirement List throttling , I'm bind list data to Grid view through SPQuery , but in that grid view having page navigation. i want each page 100 records . how to set the share point list data to each page 100 items through SPQuery
Hello,
You need to define pagesize property of gridview to set limit. Refer below links for your ref:
https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagesize.aspx
And here is code snippet to implementing paging in grid:
http://blog.techperspect.com/2011/03/step-by-step-guide-to-implement-paging.html
Hope it could help
Hi
You can use the ListItemCollectionPosition class to implement paging list item.Below is the link for the same.
https://msdn.microsoft.com/en-us/library/office/ee534956(v=office.14).aspx
try these links:
http://blog.techperspect.com/2011/03/step-by-step-guide-to-implement-paging.html
https://msdn.microsoft.com/en-us/library/office/ee534956(v=office.14).aspx
---------------------------------------------------------------------------------------------------------------------------Hi,
For me the best way is collect all records from the list and fill a DataTable.
After that you have in your side the Source and now you have the possibility to do whatever you want.
You could take ObjectDataSource with the following code:
SPQuery query = new SPQuery(); string fields = @"<FieldRef Name='CustomerID'/><FieldRef Name='CompanyName'/>"; query.ViewFields = fields; query.RowLimit = 100; int i = 1; do { SPListItemCollection coll = list.GetItems(query); dt = coll.GetDataTable(); dt.TableName = "Page" + i.ToString(); ds.Tables.Add(dt); query.ListItemCollectionPosition = coll.ListItemCollectionPosition; i++; } while (query.ListItemCollectionPosition != null);