为什么我的不能异步刷新,是我少了什么东西么?
我是真没豆豆了,各位大大走过留点宝贵意见可好
实体类
public partial class Student { public int DocId { get; set; } public string StuName { get; set; } public Nullable<int> StuAge { get; set; } }
view
@using Webdiyer.WebControls.Mvc @model Webdiyer.WebControls.Mvc.PagedList<MvcApplication1.Models.Student> <div id="MVCpager"> <table> <tr> <th> 序号 </th> <th> 年龄 </th> <th> 姓名 </th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.DocId) </td> <td> @Html.DisplayFor(modelItem => item.StuAge) </td> <td> @Html.DisplayFor(modelItem => item.StuName) </td> <td> @Html.ActionLink("Delete", "Delete", new { id = item.DocId }) </td> </tr> } </table> <div style="float: left; width: 50%">共 @Model.TotalPageCount 页 @Model.TotalItemCount 条记录,当前为第 @Model.CurrentPageIndex 页</div> <br /> <div style="float: left; width: 30%"> @Ajax.Pager(Model, new PagerOptions { PageIndexParameterName = "id", ShowPageIndexBox = true, PageIndexBoxType = PageIndexBoxType.DropDownList, ShowGoButton = false, }, new MvcAjaxOptions { UpdateTargetId = "MVCpager", DataFormId = "searchForm", EnablePartialLoading = true }, new { style = "float:right" }) </div> </div>
Controller
public ActionResult Index(int? id, string name) { id = id ?? 1; int pageSize = 3; MyTestEntities db = new MyTestEntities(); IQueryable<Student> temp = db.Student.Where(c => true).OrderBy(c => c.DocId); PagedList<Student> pageList = temp.AsQueryable<Student>().ToPagedList<Student>(id.Value, pageSize); if (Request.IsAjaxRequest()) { return PartialView("_ParIndex", pageList); } return View(pageList); }
搞定了,唉······都没人理,还是靠自己好
请问你这个问题是怎么解决的
同问解决了你放出来啊