Get Previous item in a list
<p>I've a previous/next setup in the works, and the next functionality is working fine (although, that was created by someone else a while back). As for the previous button, that is giving me a few problems.</p>

<p>Here is the code so far:</p>

<pre><code>    private Item getPrevious()
    {
        Item CurrentItem = Sitecore.Context.Item;
        var blogHomeID = "{751B0E3D-26C2-489A-8B8C-8D40E086A970}";
        Item BlogItem =db.Items.GetItem(blogHomeID);
        Item[] EntryList= BlogItem.Axes.SelectItems("descendant::*[@@templatename='BlogEntry']");

        Item prevEntry = null;

        for (int i = 0; i &lt; EntryList.Length; i++)
        {
            if (EntryList[i] == CurrentItem)
            {
                return prevEntry;
            }

            prevEntry = EntryList[i];
        }
    }
</code></pre>

<p>I get that you need to subtract 1 from the current item in the list to get the previous, but so far, all this seems to do is display the exact same entry for the previous button. It's always the latest entry in the list, not the previous one. I feel like this shouldn't be so difficult but it could be the old code I'm trying to work with. Not sure.</p>