tags:

views:

50

answers:

1

Can you help me? I used contoller HomeConrtoller.cs for view, edit and delete articles. All work, but When I go to the next page I get error don't found http://local.../Articles/1
public ActionResult Articles(int? page)

 {  
    var viewData = mybaseRepository.FindAllArticles();  
    const int pageSize = 10;  
    var paginatedArticle = new PaginatedList<Article>(viewData, page ?? 0 ,   pageSize);  
   ViewData["Page"] = paginatedArticle.PageIndex;  
   return View(paginatedArticle);  
 }     
In Global.asax.cs  
 routes.MapRoute(  
  "Articles",  
  "Articles/{page}",  
  new { controller = "Home", action = "Aticles", page = (int?)null }  
  );  

paging in Articles.aspx

<% if (Model.HasPreviousPage) { %>
<%= Html.RouteLink("предыдущая <<<",
"Articles",
new {page = (Model.PageIndex - 1) })%>
<% } %>

    <% if (Model.HasNextPage) { %>    
        <%= Html.RouteLink(">>> следующая",    
         "Articles",     
          new {page = (Model.PageIndex + 1) })%>   
   <% } %>        
<div>  
A: 

You wrote "Articls" in the URL but "Articles" when defining the route. Would that be it?

Rune
Another typo is `action = "Aticles"`
William Brendel
When I wrote this text I pass "e" right http://local.../Articles/1
Alex
William's right. still mapping action's Aticles. new { controller = "Home", action = "Aticles", page = (int?)null }
cem