MVC-未找到页面http://local.../Articles/1

时间:2010-02-23 22:59:21

标签: asp.net-mvc

你能帮帮我吗?我使用contoller HomeConrtoller.cs来查看,编辑和删除文章。所有的工作,但当我转到下一页时,我得到错误没有找到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 }  
  );  
     在Articles.aspx中进行分页        
        &lt;%if(Model.HasPreviousPage){%&gt;
          &lt;%= Html.RouteLink(“предыдущая&lt;&lt;&lt;”,

            “公司章程”,
              new {page =(Model.PageIndex - 1)})%&gt;
           &lt;%}%&gt;

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

1 个答案:

答案 0 :(得分:0)

在URL中写“文章”,但在定义路径时写“文章”。那会是吗?