SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a webpart with list items paging. I followed this link and on SharePoint 2010 server it works good, but on 2013 it doesn't.

public SPListItemCollection GetTestItems(string pagingInfo)

        SPWeb objWeb = SPContext.Current.Web;

        SPListItemCollection collection;
        SPQuery objQuery = new SPQuery();

        objQuery.RowLimit = (uint)MaxItemsOnPage;

        objQuery.Query = Camlex.Query().OrderBy(i => i[SPBuiltInFieldId.Created] as Camlex.Desc).ToString();
        objQuery.ViewFields = Camlex.Query().ViewFields(i => i["Title"]);

        if (!string.IsNullOrEmpty(pagingInfo))
            SPListItemCollectionPosition position = new SPListItemCollectionPosition(pagingInfo);
            objQuery.ListItemCollectionPosition = position;

        collection = objWeb.Lists["testList"].GetItems(objQuery);
        return collection;

When pagingInfo string is not null, it means when I push "next" and pagingInfo = "Paged=TRUE&p_ID=3&p_Created=20130502%2022%3A19%3A00", the query return collection with 0 items.

I tried to remove p_Created=20130502%2022%3A19%3A00 from paging info string and don't use ordering in query it works. But I need to sort it by Created field, descending.

I make p_Created value like

SPEncode.UrlEncode( Convert.ToString(collection[collection.Count - 1]["Created"]));

Maybe datetime formating in incorrect for sharepoint 2013 or they changed something in pagingInfo string format?

share|improve this question
why don't you use, allowpaging=true for gridview ? – Muhammad Raja May 3 '13 at 11:32
actually, I need to make paging for asp repeater, but I train on this example. – alisa May 3 '13 at 11:34
up vote 1 down vote accepted

I resolved the problem sorting items by ID instead of Created field. So I think problem is in datetime format, I didn't find how to fix it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.