• 分页1


    一.Ajax

    // 重複項目削除
                for (int i = 0; i < recipeList.Count; i++)
                {
                    for (int j = i + 1; j < recipeList.Count; j++)
                    {
                        if (recipeList[i].materialName == recipeList[j].materialName && recipeList[i].materialVolume == recipeList[j].materialVolume)
                        {
                            recipeList[i].num++;
                            recipeList.RemoveAt(j);
                            j--;
                        }
                    }
                }

                // ページ分け処理
                if (recipeList != null && recipeList.Count() > 0)
                {
                    int pageCount = 0;
                    if (recipeList.Count() % onePageCount == 0)
                    {
                        pageCount = recipeList.Count() / onePageCount;
                    }
                    else
                    {
                        pageCount = recipeList.Count() / onePageCount + 1;
                    }
                    model.pageCount = pageCount;

                    if (pageNo <= pageCount)
                    {
                        model.startItemNo = (pageNo - 1) * onePageCount;
                        if (pageNo == pageCount)
                        {
                            model.lastItemNo = recipeList.Count() - 1;
                        }
                        else
                        {
                            model.lastItemNo = pageNo * onePageCount - 1;
                        }
                        model.totalCount = recipeList.Count();

                        // Skip数量
                        int SkinCount = (pageNo - 1) * onePageCount;
                        model.RecipeMaterialList = recipeList.Skip(SkinCount).Take(onePageCount).ToList();
                    }
                }

    <div id="page-break">
                    <ul class="breaklist">
                        @if (Model.pageNo > 1)
                        {
                            <li class="pageBack">@*<a class="glbPanelNew_r" href="/Genearea/RecipeMaterial/Result/?recipeId=@(Model.recipeId)&amp;no=@(Model.pageNo - 1)"">*@
                               <a class="glbPanelNew_r" href="javascript:getAjaxPageDate('recipeId=@(Model.recipeId)&no=@(Model.pageNo - 1)')">
                                    <img width="12" alt="" src="http://www.cnblogs.com/http://www.cnblogs.com/Content/DnaDiet/img/sprites/arrow-l-01.png"></a></li>
                        }
                        else
                        {
                            <li class="pageBack"><a class="glbPanelNew_r" href="#">
                                <img width="12" alt="" src="http://www.cnblogs.com/http://www.cnblogs.com/Content/DnaDiet/img/sprites/arrow-l-02.png"></a></li>
                        }
                        <li class="pageNumber"><span>@(Model.startItemNo + 1)~@(Model.lastItemNo + 1)/@(Model.totalCount)</span></li>
                        @if (Model.pageNo < Model.pageCount)
                        {
                            <li class="pageNext">@*<a class="glbPanelNew_r" href="/Genearea/RecipeMaterial/Result/?recipeId=@(Model.recipeId)&amp;no=@(Model.pageNo + 1)">*@
                                <a class="glbPanelNew_r" href="javascript:getAjaxPageDate('recipeId=@(Model.recipeId)&no=@(Model.pageNo + 1)')">
                                    <img width="12" alt="" src="http://www.cnblogs.com/http://www.cnblogs.com/Content/DnaDiet/img/sprites/arrow-r-01.png"></a></li>
                        }
                        else
                        {
                            <li class="pageNext"><a class="glbPanelNew_r" href="#">
                                <img width="12" alt="" src="http://www.cnblogs.com/http://www.cnblogs.com/Content/DnaDiet/img/sprites/arrow-r-02.png"></a></li>
                        }
                    </ul>
                </div>
  • 相关阅读:
    Celery框架
    Tensorflow安装记录
    OpenFace的一些了解
    CentOS+Uwsgi+Nginx发布Flask开发的WebAPI
    Always On 集群监听创建失败问题
    SQL Server 安装好后 Always On群组配置
    Sql server 2016 Always On 搭建Windows集群配置
    汕头市队赛 SRM13 T3
    bzoj 1314: River过河 树套树+单调队列
    hdu 6119 …&&百度之星 T6
  • 原文地址:https://www.cnblogs.com/liqb/p/2876567.html
Copyright © 2020-2023  润新知