Mvc-infinite-scroll包空会话

时间:2015-06-19 11:42:41

标签: c# asp.net-mvc session infinite-scroll

我正在尝试实施此pakage

从数据库加载数据后,我将其存储为:

Session["reservations"] = futureReservations.ToDictionary(x => custIndex++, x => x);

然后我试图只获取当前页面所需的数据:

public Dictionary<int, Restaurants> GetRecordsForPage(int pageNum)
        {
            Dictionary<int, Restaurants> reservations = (Session["reservations"] as Dictionary<int, Restaurants>);

            int from = (pageNum * RecordsPerPage);
            int to = from + RecordsPerPage;


            return reservations
                .Where(x => x.Key > from && x.Key <= to)
                .ToDictionary(x => x.Key, x => x.Value);
        }

问题是即使会话信息正确,reservations变量仍保持为空。任何人都可以帮我找出原因吗?

0 个答案:

没有答案