多查询条件的MVC分页

15 篇文章 0 订阅
4 篇文章 0 订阅

1、查询

    <div class="span8">
        @using (Ajax.BeginForm("方法", "控制器",
                new RouteValueDictionary { { "id", "" } }, new AjaxOptions()
                {
                    HttpMethod = "Get",
                    UpdateTargetId = "PageDiv",
                    InsertionMode = InsertionMode.Replace
                }, new RouteValueDictionary { { "id", "searchForm" } }))
        {
            <div class="dataTables_filter">
                <label>
                    <button type="submit" class="btn">搜索 <i class="icon-search"></i></button>
                </label>
                <label>
                    <span>名称:</span>
                    @Html.TextBox("SearchName", null, new { @class = "m-wrap small" })                    
                </label>
                <label>
                    <span>类型:</span>
                    @Html.DropDownList("SearchCouponType", new SelectListItem[] { new SelectListItem { Text = "全部", Value = "0" }, new SelectListItem { Text = "类型一", Value = "1" }, new SelectListItem { Text = "类型二 ", Value = "2" } })
                </label>
            </div>
        }
    </div>

2、分页里添加 DataFormId = "searchForm"

<div id="showPage" class="pages">
    @Ajax.Pager(Model, new PagerOptions { PageIndexParameterName = "id", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", CurrentPagerItemTemplate = "<a href=\"#\" class=\"number current\">{0}</a>", DisabledPagerItemTemplate = "<a disabled >{0}</a>", PagerItemTemplate = "{0}" }, new MvcAjaxOptions { UpdateTargetId = "PageDiv", DataFormId = "searchForm" })
    <span>总页数:@Model.TotalPageCount</span><span>总条数:@Model.TotalItemCount</span>
</div>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值