Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 始终在@Html.PagedListPager中选择X.PagedList.NET核心第一页_Asp.net_Asp.net Core_Pagedlist - Fatal编程技术网

Asp.net 始终在@Html.PagedListPager中选择X.PagedList.NET核心第一页

Asp.net 始终在@Html.PagedListPager中选择X.PagedList.NET核心第一页,asp.net,asp.net-core,pagedlist,Asp.net,Asp.net Core,Pagedlist,我已经使用X.PagedList nuget为.Net Core 3项目创建了分页,当我单击页码时,它会调用检索局部视图和更新数据列表的div的操作,一切正常,但当我单击页码2时,列表中的数据已更新,但当前页面选择仍为1,它应该更改为2。每次单击大于1的页面时,所选内容在PagedListPager中保持为1 @Html.PagedListPager(Model.OrderViewModels, page => Url.Action("OrdersSearch2"

我已经使用X.PagedList nuget为.Net Core 3项目创建了分页,当我单击页码时,它会调用检索局部视图和更新数据列表的div的操作,一切正常,但当我单击页码2时,列表中的数据已更新,但当前页面选择仍为1,它应该更改为2。每次单击大于1的页面时,所选内容在PagedListPager中保持为1

    @Html.PagedListPager(Model.OrderViewModels, page => Url.Action("OrdersSearch2", "Orders",
    new { ViewBag.SearchName, page = page }),
    PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new PagedListRenderOptions
    {
        LiElementClasses = new string[] { "page-item" },
        PageClasses = new string[] { "page-link" },
                                                               
    }
    , new AjaxOptions()
    {
        HttpMethod = "POST",
        UpdateTargetId = "OrdersList",

    }))
OrdersIndexViewModel

    public class OrdersIndexViewModel
{
    public IPagedList<OrderViewModel> OrderViewModels { get; set; }
    public SearchOrderViewModel SearchOrderViewModel { get; set; }

}
Index.cshtml

        @model OrdersIndexViewModel
<div id="OrdersList">
           <partial name="_OrdersListPartial.cshtml" model="Model.OrderViewModels" />
</div>
@model OrdersIndexViewModel

_OrdersListPartial.cshtml

@model X.PagedList.IPagedList<OrderViewModel>
@{
    int rowNo = 0;
}


<div id="basic-examples">
    <div class="card">
        <div class="card-content">
            <div class="card-body">
            <div class="row">
                <div class="col-12">
                    <input type="submit" value="New Order" class="btn btn-primary mr-1 mb-1 waves-effect waves-light" onclick="location.href='@Url.Action("AddOrder", "Orders")'" />

                </div>
            </div>
            <div class="" id="OrdersList">
                @if (Model == null || Model.Count == 0)
                {
                    <div class="alert alert-warning">No Orders</div>
                }
                else
                {
                    <div class="row">
                        <div class="col-12">
                            <div class="card">
                                <div class="card-header">
                                    <h4 class="mb-0">Orders List</h4>
                                </div>
                                <div class="card-content">
                                    <div class="table-responsive mt-1">
                                        <table class="table table-hover-animation mb-0">
                                            <thead>
                                                <tr>
                                                    <th>#</th>
                                                    <th>ID</th>
                                                    <th>CUSTOMER NAME</th>
                                                    <th>CREATED</th>
                                                    <th>DELIVERY DATE</th>
                                                    <th>STATUS</th>


                                                    <th>OPERATORS</th>
                                                    <th></th>
                                                    <th style="display:none"></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                @foreach (var i in @Model)
                                                {
                                                    rowNo = rowNo + 1;
                                                    <tr>
                                                        <td>@rowNo</td>
                                                        <td>@ViewBag.OrdersPrefix @i.ID</td>
                                                        <td><i class="fa fa-circle font-small-3 text-success mr-50"></i>@i.CustomerName</td>
                                                        <td>@Html.DisplayFor(x => i.CreatedDate)</td>
                                                        <td>@Html.DisplayFor(x => i.DeliveryDate)</td>
                                                        <td>@i.OrderStatusText</td>

                                                        <td class="p-1">
                                                            <ul class="list-unstyled users-list m-0  d-flex align-items-center">
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Vinnie Mostowy" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-5.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Elicia Rieske" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-7.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Julee Rossignol" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-10.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Darcey Nooner" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-8.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                            </ul>
                                                        </td>

                                                        <td>
                                                            @Html.ActionLink("Edit", "EditOrder", "Orders", routeValues: new { ID = i.ID })
                                                        </td>
                                                        <td style="display:none">
                                                            <i class="feather icon-trash"></i>
                                                            @Html.ActionLink("Delete", "DeleteOrderDetailTempItem", "Orders", routeValues: new { ID = i.ID }, htmlAttributes: new
                                                                  {
                                                                      @data_ajax = "true",
                                                                      @data_ajax_method = "Get",
                                                                      @data_ajax_update = "#OrderDetailList",
                                                                      @data_ajax_failure = "onFailureDefault",
                                                                      @data_ajax_success = "ViewOnSuccess",
                                                                  })


                                                        </td>
                                                    </tr>
                                                }
                                            </tbody>
                                        </table>
                                    </div>



                                </div>
                            </div>
                        </div>
                    </div>
                }

            </div>
        </div>
    </div>
</div>
@model X.PagedList.IPagedList
@{
int rowNo=0;
}
@if(Model==null | | Model.Count==0)
{
没有命令
}
其他的
{
订单清单
#
身份证件
客户名称
创建
交货日期
地位
操作员
@foreach(模型中的变量i)
{
rowNo=rowNo+1;
@罗诺
@ViewBag.OrdersPrefix@i.ID
@i、 客户名称
@DisplayFor(x=>i.CreatedDate)
@DisplayFor(x=>i.DeliveryDate)
@i、 订单状态文本
@ActionLink(“Edit”、“EditOrder”、“Orders”、routeValue:new{ID=i.ID}) @ActionLink(“Delete”,“DeleteOrderDetailTempItem”,“Orders”,routeValue:new{ID=i.ID},htmlAttributes:new { @数据\u ajax=“true”, @数据\u ajax\u method=“Get”, @数据_ajax_update=“#OrderDetailList”, @数据\u ajax\u failure=“onFailureDefault”, @data\u ajax\u success=“ViewOnSuccess”, }) }
@model X.PagedList.IPagedList<OrderViewModel>
@{
    int rowNo = 0;
}


<div id="basic-examples">
    <div class="card">
        <div class="card-content">
            <div class="card-body">
            <div class="row">
                <div class="col-12">
                    <input type="submit" value="New Order" class="btn btn-primary mr-1 mb-1 waves-effect waves-light" onclick="location.href='@Url.Action("AddOrder", "Orders")'" />

                </div>
            </div>
            <div class="" id="OrdersList">
                @if (Model == null || Model.Count == 0)
                {
                    <div class="alert alert-warning">No Orders</div>
                }
                else
                {
                    <div class="row">
                        <div class="col-12">
                            <div class="card">
                                <div class="card-header">
                                    <h4 class="mb-0">Orders List</h4>
                                </div>
                                <div class="card-content">
                                    <div class="table-responsive mt-1">
                                        <table class="table table-hover-animation mb-0">
                                            <thead>
                                                <tr>
                                                    <th>#</th>
                                                    <th>ID</th>
                                                    <th>CUSTOMER NAME</th>
                                                    <th>CREATED</th>
                                                    <th>DELIVERY DATE</th>
                                                    <th>STATUS</th>


                                                    <th>OPERATORS</th>
                                                    <th></th>
                                                    <th style="display:none"></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                @foreach (var i in @Model)
                                                {
                                                    rowNo = rowNo + 1;
                                                    <tr>
                                                        <td>@rowNo</td>
                                                        <td>@ViewBag.OrdersPrefix @i.ID</td>
                                                        <td><i class="fa fa-circle font-small-3 text-success mr-50"></i>@i.CustomerName</td>
                                                        <td>@Html.DisplayFor(x => i.CreatedDate)</td>
                                                        <td>@Html.DisplayFor(x => i.DeliveryDate)</td>
                                                        <td>@i.OrderStatusText</td>

                                                        <td class="p-1">
                                                            <ul class="list-unstyled users-list m-0  d-flex align-items-center">
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Vinnie Mostowy" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-5.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Elicia Rieske" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-7.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Julee Rossignol" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-10.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                                <li data-toggle="tooltip" data-popup="tooltip-custom" data-placement="bottom" data-original-title="Darcey Nooner" class="avatar pull-up">
                                                                    <img class="media-object rounded-circle" src="../../../app-assets/images/portrait/small/avatar-s-8.jpg" alt="Avatar" height="30" width="30">
                                                                </li>
                                                            </ul>
                                                        </td>

                                                        <td>
                                                            @Html.ActionLink("Edit", "EditOrder", "Orders", routeValues: new { ID = i.ID })
                                                        </td>
                                                        <td style="display:none">
                                                            <i class="feather icon-trash"></i>
                                                            @Html.ActionLink("Delete", "DeleteOrderDetailTempItem", "Orders", routeValues: new { ID = i.ID }, htmlAttributes: new
                                                                  {
                                                                      @data_ajax = "true",
                                                                      @data_ajax_method = "Get",
                                                                      @data_ajax_update = "#OrderDetailList",
                                                                      @data_ajax_failure = "onFailureDefault",
                                                                      @data_ajax_success = "ViewOnSuccess",
                                                                  })


                                                        </td>
                                                    </tr>
                                                }
                                            </tbody>
                                        </table>
                                    </div>



                                </div>
                            </div>
                        </div>
                    </div>
                }

            </div>
        </div>
    </div>
</div>