Subsonic 3.0.0.3 MVC2 How to Work Swap Model.HasPreviousPage Doesn't Work

Hi, I want to have a good swap for my subsonic project, I am fine with the code however I cannot find any information regarding paging on the side of viewing things.

I tried

Model.HasPreviousPage

but this no longer exists, so all of the ideas about where to even start, there is some hidden guide for this material somewhere, and activerecord, because I really don’t like to come and ask and, most likely, I could read and search, but for the most modern things.

everything that I find seems to be for older versions of MVC or older versions of subsonic or worse than both of them.

much appreciated

0
source share
1

, , , , , :

()

public ActionResult Index(int? page)
    {
        if (!validateInt(page.ToString()))
            page = 0;

        page = page - 1;

        if (page < 0)
            page = 0;

        const int pagesize = 9;

        IQueryable<material> myMaterial = material.All().Where(x => x.category == "Granite").OrderBy(x => x.id);
        var mycount = material.All().Where(x => x.category == "Granite").OrderBy(x => x.id).Count();

        ViewData["numpages"] = mycount / 9;
        ViewData["curpage"] = page;

        return View(new PagedList<material>(myMaterial, page ?? 0, pagesize));

    }

Html

showing page <%=Convert.ToInt32(ViewData["curpage"]) + 1 %> of <%=ViewData["numpages"] %><br />
<%
   for (int i = 1; i <= Convert.ToInt32(ViewData["numpages"]); i++)
   {
      %> 

      <span><b><%= Html.ActionLink(i.ToString(),"Index","granite",new{page=i},null) %></b></span>

      <% 
   } 

% >

span , , ???

, , , , , 9 , .

+1

Source: https://habr.com/ru/post/1719635/


All Articles