net页面传值分页

 <%-- <%
                  // 初始化
                  int cPage = 1;
                  int nPage = cPage + 1;
                  int linesPerpage=3;

                  //总页数

                        int col = NewsUtility.GetAll().Count;

                        //给参
                        if (!IsPostBack)
                        {
                            cPage = 1;
                        }
                        else
                        {
                            Response.Write(string.Format(JsHelper.WINALERTSCRIPT, Request.QueryString["page"].ToString()));
                            if (string.IsNullOrEmpty(Request.QueryString["page"].ToString()))
                            {
                                cPage = Convert.ToInt32(Request.QueryString["page"].ToString());
                            }
                            else
                            {
                                cPage = 1;
                            }
                        }
                      
                        //判断越界
                        int fPage = cPage > 1 ? cPage - 1 : 1;

                        int totalPage = col % linesPerpage == 0 ? (col / linesPerpage) : (col / linesPerpage + 1);

                        if (cPage >= totalPage)
                        {
                            nPage = cPage;
                        }
                        else
                        {
                            nPage = cPage + 1;
                        }

                        IList list_news = NewsUtility.GetAllNewsOfFenye(cPage, linesPerpage);
                        foreach (News news in list_news)
                        {
                  %>
                <tr>
                        <td style="width: 300px; height: 63px;">
                            <asp:Image ID="Image1" runat="server" ImageUrl="~/HengfuIndex/img/8.gif" />&nbsp;<a href="DetailNews.aspx?id=<%=news.NewsID %>"><%=news.NewsTitle %></a></td>
                        <td style="width: 383px; height: 63px;">
                        <%=news.PubTime.ToString("yyyy-MM-dd") %>
                        </td>
                    </tr>
                   <%
                   }
                   %>--%>
             <%--<div style="float:left; width:100%;">
                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                <a href="AllNews.aspx?page=<%=fPage%>">上一页</a>|
      <a href="AllNews.aspx?page=<%=nPage%>">下一页</a>
             </div>--%>
                            <%-- <%
                  // 初始化
                  int cPage = 1;
                  int nPage = cPage + 1;
                  int linesPerpage=3;

                  //总页数

                        int col = NewsUtility.GetAll().Count;

                        //给参
                        if (!IsPostBack)
                        {
                            cPage = 1;
                        }
                        else
                        {
                            Response.Write(string.Format(JsHelper.WINALERTSCRIPT, Request.QueryString["page"].ToString()));
                            if (string.IsNullOrEmpty(Request.QueryString["page"].ToString()))
                            {
                                cPage = Convert.ToInt32(Request.QueryString["page"].ToString());
                            }
                            else
                            {
                                cPage = 1;
                            }
                        }
                      
                        //判断越界
                        int fPage = cPage > 1 ? cPage - 1 : 1;

                        int totalPage = col % linesPerpage == 0 ? (col / linesPerpage) : (col / linesPerpage + 1);

                        if (cPage >= totalPage)
                        {
                            nPage = cPage;
                        }
                        else
                        {
                            nPage = cPage + 1;
                        }

                        IList list_news = NewsUtility.GetAllNewsOfFenye(cPage, linesPerpage);
                        foreach (News news in list_news)
                        {
                  %></TD></TR><TR><TD style="WIDTH: 620px; HEIGHT: 63px"><asp:Image id="Image1" runat="server" ImageUrl="~/HengfuIndex/img/8.gif"></asp:Image>&nbsp;<A
      href="DetailNews.aspx?id=<%=news.NewsID %>"><%=news.NewsTitle %></A></TD><TD
    style="WIDTH: 383px; HEIGHT: 63px"><%=news.PubTime.ToString("yyyy-MM-dd") %></TD></TR><%
                   }
                   %>--%&gt; <%--<div style="float:left; width:100%;">
                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                <a href="AllNews.aspx?page=<%=fPage%>">上一页</a>|
      <a href="AllNews.aspx?page=<%=nPage%>">下一页</a>
             </div>--%>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值