• ASP.ENT中上一篇和下一篇


    前台页面:
    <div class="mtgz_prev_next">
        <p>
            <span class="textcolor6">上一篇:</span>
            <asp:Label ID="lblPre" runat="server" Text=""></asp:Label>
        </p>
        <p>
            <span class="textcolor6">下一篇: </span>
            <asp:Label ID="lblNext" runat="server" Text=""></asp:Label>
        </p>
    </div>

    后台代码:
    protected void GetPreTitle()
            {
                if (!string.IsNullOrEmpty(NewsID))
                {
                    int num = Convert.ToInt32(NewsID);
                    DataSet ds = bll.GetList("ID=" + (num - 1));
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        newsArr["PreTitle"] = ds.Tables[0].Rows[0]["Title"].ToString();
                        newsArr["PreID"] = num - 1;
                        lblPre.Text=" <a href=ljwm-mtgz-ny.aspx?ID=" + newsArr["PreID"].ToString() + ">" + newsArr["PreTitle"].ToString() + "</a>";
                    }
                    else
                    {
                        lblPre.Text ="已经是第一篇";
                    }
                }
            }
            
            
    protected void GetNextTitle()
            {
                if (!string.IsNullOrEmpty(NewsID))
                {
                    int num = Convert.ToInt32(NewsID);
                    DataSet ds = bll.GetList("ID=" + (num + 1));
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        newsArr["NextTitle"] = ds.Tables[0].Rows[0]["Title"].ToString();
                        newsArr["NextID"] = num + 1;
                        lblNext.Text = " <a href=ljwm-mtgz-ny.aspx?ID=" + newsArr["NextID"].ToString() + ">" + newsArr["NextTitle"].ToString() + "</a>";
                    }
                    else
                    {
                        lblNext.Text ="已经是最后一篇";
                    }
                }
            }

  • 相关阅读:
    js中 var let const 区别
    img标签src引用网络图片,响应403的解决方法
    统计开发push数据
    gp日志查看
    node之path模块
    算法相关问题
    常用的 curl 发送 http 请求 命令
    Python与Go列表切片越界的对比
    golang时间与时区相关操作总结
    go语言结构体转map的方法
  • 原文地址:https://www.cnblogs.com/ahao214/p/3503534.html
Copyright © 2020-2023  润新知