ASP.NET Page_Load values are lagging one postback behind
<p>I have a foreach loop in the Page_Load method of my one page to determine whether to Enable a button or not.</p>

<p>Code:</p>

<pre><code>foreach (var class in classes)
{
    for (var i = studentsList.Count - 1; i &gt;= 0; i--)
    {
        if (studentsList[i].Id == class.student_id)
            studenstList.Remove(studentsList[i]);
    }
}
if (studentsList.Count == 0)
{
    button1.Enabled = false;
    button1.Text = "a";
}
else
{
    button1.Enabled = true;
    button1.Text = "b";
}
if (Page.IsPostBack) { return; }
</code></pre>

<p>The issue:</p>

<p>The value of <code>studentsList.Count</code> is lagging behind by a postback. If after the loop it should be 1, it only has the value of 1 at the next postback. I've debugged to confirm this is the case.</p>
