ASP.NET Session Shopping Cart Items issue on pageload not updating
<p>I.e. I have a piece of code on my page as follows, which is in page_load</p>

<pre><code>Dim subTotal As Integer = 0
    For Each item As CartItem In ShoppingCart.Instance.Items
        subTotal += 1
    Next

    strShoppingCart.Append(subTotal).Append(" Items")
    shoppingCartItems.Text = strShoppingCart.ToString()
</code></pre>

<p>And I can then add items to my cart as follows</p>

<p>Protected Sub Update_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim rowscount As Integer = productListTable.Rows.Count</p>

<pre><code>    For Each row As GridViewRow In productListTable.Rows
        If row.RowType = DataControlRowType.DataRow Then
            ' We'll use a try catch block in case something other than a number is typed in. If so, we'll just ignore it.
            Try
                ' Get the productId from the GridView's datakeys
                Dim productId = Convert.ToInt32(productListTable.DataKeys(row.RowIndex).Value)
                ' Find the quantity TextBox and retrieve the value
                Dim quantity = Integer.Parse(CType(row.Cells(1).FindControl("txtQuantity"), TextBox).Text)
                'Dim price = Decimal.Parse(CType(row.Cells(1).FindControl("TradePriceField"), Label).Text)
                Dim price = Decimal.Parse("16.00")
                Dim productName = CType(row.Cells(1).FindControl("ProductNameField"), Label).Text
                Dim packSize = Integer.Parse(CType(row.Cells(1).FindControl("PackSizeField"), Label).Text)
                Dim stockIndicator = Integer.Parse(CType(row.Cells(1).FindControl("PackSizeField"), Label).Text)
                ShoppingCart.Instance.AddItem(productId, quantity, price, productName, packSize, stockIndicator)


            Catch ex As FormatException

            End Try
        End If
    Next
End Sub
</code></pre>

<p>The problem is as follows</p>

<p>Page Load
Items Count is 0</p>

<p>I add a product the page still says 0 Items when there is actually 1 item in session
I refresh the page the counter goes to one</p>

<p>How can I to read from correct session count ?</p>
