MVC模式中,如何使用AJAX进行分页

列表主页Action内容:

  public ActionResult HelpList()
        {
            Entity.Commons.VPredication vp = new Entity.Commons.VPredication();
            Entity.Commons.PagingParam pp = new Entity.Commons.PagingParam(1, 10);
            Entity.PagedList list = _HelpDocumentServices.GetHelpDocument(vp, pp);
            List clist = _HelpDocumentServices.GetAllCatetories();
            clist.Insert(0, new Entity.HelpCategory() { HelpCategoryID = "", CategoryName = "选择类别" });
             ViewData["Category"] = clist;
            return View(list);
        }

列表用户控制页Action内容:

 public ActionResult PageHelp(int? pi, string title, string cid)
        {
            Entity.Commons.VPredication vp = new Entity.Commons.VPredication();
            Entity.Commons.PagingParam pp = new Entity.Commons.PagingParam(pi ?? 1, 10);
            if (!string.IsNullOrEmpty(title))
                vp.AddItem("Title", title);
            if (!string.IsNullOrEmpty(cid))
                vp.AddItem("HelpCategoryID", cid);
            Entity.PagedList list = _HelpDocumentServices.GetHelpDocument(vp, pp);
            list.AddParameters = new System.Collections.Specialized.NameValueCollection();
            list.AddParameters.Add("title", title);
            list.AddParameters.Add("cid", cid);
            return PartialView("LelpItemList", list);
        }

ASPX文件:

"Content3" ContentPlaceHolderID="ScriptContent" runat="server">
     
    
 
   
"Content2" ContentPlaceHolderID="MainContent" runat="server">
    

        class="action-span1">"/">管理中心 - 帮助管理 
    
    
        标题:"Title" type="text" />分类:
        
        "search_btn" class="button" type="button" value="查询" />
    
"helpitem_div">
        <%Html.RenderPartial("LelpItemList", Model); %>
       
    
 
  

ASCX文件内容:

 
 
 
"100%" id="" cellpadding="3" cellspacing="1"class="liebiao_table">
    
        
            
            
            
            
            
        
    
    
        <%foreach (var item in Model)
          {
        %>
        
            
            
            
            
            
        
        <%
            } 
        %>
    
                标题
            
                分类
            
                排序
            
                创建时间
            
                操作
            
                "/help/HelpDetail?helpid=<%=item.HelpDocumentID %>">
                    <%=item.Title %>
            
                <%=item.HelpCategory.FatherCategory.CategoryName %>=><%=item.HelpCategory.CategoryName %>
            
"center">
                <%=item.SortNumber %>
            
"center">
                <%=item.CreateDate %>
            
"center">
                "javascript:void(0)" οnclick="ActiveWin('/help/HelpDetail?helpid=<%=item.HelpDocumentID %>')">
                    查看  "javascript:void(0)" οnclick="ActiveWin('/Help/EditHelp?hid=<%=item.HelpDocumentID %>')">编辑   
   
                        href="javascript:void(0)" οnclick="DelHtml('<%=Model.PageIndex %>','<%=item.HelpDocumentID %>')">删除
            
<%=Html.AjaxPager(Model, "helpitem_div", "PageHelp", "Help")%>

你可能感兴趣的:(MVC+Ef)