@{
    //获取上下篇，下一篇数据
    string infoTable = (string)ViewBag.InfoTable;
    int columnId = (int)ViewBag.ColumnId;//当前栏目id
    int infoId = (int)ViewBag.InfoId;
    var dbContext = DbHelper.DbContext();
    dynamic prevData = dbContext.QueryFirst(infoTable,"columnId,id,title", "columnId=" + columnId + " and [state]=1 and id>" + infoId, "id asc");
    dynamic nextData = dbContext.QueryFirst(infoTable,"columnId,id,title", "columnId=" + columnId + " and [state]=1 and id<" + infoId, "id desc");
}
<div class="sublanmu_pn clearfix">
    <ul>
        @if (prevData != null)
        {
            string url = Html.InfoDataUrl(infoTable, (int)prevData.Id);
            <li>上一篇：<a href="@url">@StringHelper.SubString(prevData.Title, 100)</a></li>
        }
        @if (nextData != null)
        {
            string url = Html.InfoDataUrl(infoTable, (int)nextData.Id);
            <li>下一篇：<a href="@url">@StringHelper.SubString(nextData.Title, 100)</a></li>
        }
    </ul>
</div>