首页 新闻 会员 周边 捐助

关于MvcPager局部刷新,

0
悬赏园豆:10 [已解决问题] 解决于 2015-06-09 11:25

为什么我的不能异步刷新,是我少了什么东西么?

 我是真没豆豆了,各位大大走过留点宝贵意见可好

实体类

    public partial class Student
    {
        public int DocId { get; set; }
        public string StuName { get; set; }
        public Nullable<int> StuAge { get; set; }
    }
View Code

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>
View Code

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);
        }
View Code
若云的主页 若云 | 菜鸟二级 | 园豆:214
提问于:2015-06-08 17:01
< >
分享
最佳答案
0

搞定了,唉······都没人理,还是靠自己好

若云 | 菜鸟二级 |园豆:214 | 2015-06-09 11:24

请问你这个问题是怎么解决的

沙漏dan | 园豆:200 (初学一级) | 2016-04-05 10:33
其他回答(1)
0

同问解决了你放出来啊

无觉-李敏 | 园豆:404 (菜鸟二级) | 2017-04-01 21:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册