c# - How to customize a specific code for pagination when working with datagridview virtual mode on -
i reading xml file instead of database table , doing pagination way
xdocument document = xdocument.load(xmlfilepath); var query = r in document.descendants("orders") select new { orderid = r.element("orderid").value, customerid = r.element("customerid").value, employeeid = r.element("employeeid").value }; query = query.orderby(sortcolumn + " " + orderdirection); query = query.skip(lowerpageboundary - 1 * rowsperpage).take(rowsperpage);
but problem lowerpageboundary
value controller class got msdn link https://msdn.microsoft.com/en-us/library/ms171624.aspx?f=255&mspperror=-2147217396
i following same code msdn gave pagination routine not compatible below code , not working too.
query = query.skip(lowerpageboundary - 1 * rowsperpage).take(rowsperpage);
first time lowerpageboundary
0 skip has 0 value , take has 16 value , when same line execute second time lowerpageboundary
16-16=0
so request 1 please see msdn link gave here , see cache class controlling value lowerpageboundary
, suggest me how customize linq skip , take msdn code scenario.
thanks
it seems don't have deduct rowsperpage lowerpageboundary. i.e. first page lowerpageboundary = 0, rowsperpage = 16, need skip 0 records , take 16. second page lowerpageboundary = 16, need skip 16 rows, , take 16 next ones etc. i.e. should use next code:
query = query.skip(lowerpageboundary).take(rowsperpage);
Comments
Post a Comment