• 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 ="已经是最后一篇";
                    }
                }
            }

  • 相关阅读:
    关于GDI+的图片质量
    断点续传的Demo
    offic2007 ,offic2010安装失败 1935错误处理方案
    Easy Slider幻灯片 API
    Lazyload.js延迟加载效果
    MVC3中 多种跳转方式总结
    MVC中 DropDownList编辑默认选中的使用
    ASP.NET Session的七点认识
    easyui 的datagrid的自适应宽度的问题
    Linux常用文件操作高频使用命令
  • 原文地址:https://www.cnblogs.com/ahao214/p/3503534.html
Copyright © 2020-2023  润新知