Problem in DataGrid custom paging
I want to implement the custom paging with DataGrid and don't to move to GridView for that as done in this link A Neat Solution to GridView Custom Paging, because the project that I am working is already built using DataGrids.
Also, I Searched thru internet but was unable to find custom paging without using ObjectDataSource. Using ObjectDataSource is associated in my mind with quick demos that you can see at conferences and in video tutorials (which typically tells me "don't do it this way in production").
Also my data would be coming out from stored procedure using CTE query:
SELECT * FROM (SELECT RowID = ROW_NUMBER() OVER ([Name] ORDER BY ASC),
[ID],[Name],[Status] FROM [UserMaster]) as [UserMaster]
WHERE ((RowID BETWEEN @StartIndex AND @StartIndex-@PageSize-1) OR @StartIndex = -1 OR @PageSize = -1)
This query is partial implementation to give idea how it is working, Here in this query, if @StartIndex and @PageSize is not passed then all records would be returned and I have tested query and it is working as expected. Query is built in reference to N-Layered Web Applications with ASP.NET 3.5 Part 4: Sortin开发者_运维百科g, Paging and Filtering
In Code,
What I am doing in working old code is set AllowPaging=false
, AllowCustomPaging=true
, and VirtualItemcount=100
,
but this does not works as the paging is not at all being rendered now.
Then i tried to tweak and set AllowPaging=true
, AllowCustomPaging=true
, and VirtualItemcount=100
this renders the paging and but does not help as click on pagedItem does not changes the DataColumns in Content Area.
I hope it is all well explained.
Also I have found some links which were not of much help to me, hope that helps in improving the answerers part.
Efficient Data Paging with the ASP.NET 2.0 DataList Control and ObjectDataSource
smart paging with datagrid
ASP.NET DataGrid and custom paging
Will How does pagination work in ASP.NET(Using VB.NET)? help you?
精彩评论