前台页面:
<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 ="已经是最后一篇";
                }
            }
        }

05-11 14:04