I'm trying to get 2 variables to "refresh" on the top part of the
page when a function is called that updates them.
I want to keep the "total number of items" and "total amount" for the shopping cart
updated on the Default.aspx page to the current values whenever they are changed.
On the Page_Load of Default.aspx, I load different user controls into the Body like:
Dim control As Control
control = Page.LoadControl("UserControls/selected_page_here.ascx")
pageContentsCell.Controls.Add(control)
items.Text = Session("items")
total.Text = Session("total")
in .aspx:
<td id="pageContentsCell" runat="server">
<asp:Label Runat=server ID="total"></asp:Label>
<asp:Label Runat=server ID="items"></asp:Label>
The problem is when "Add to Cart" is clicked, the variables are not updated
(I don't display the shopping cart when Add to Cart is clicked):
Private Sub Add to Cart
Session("items") = cartHead.Total_Items
Session("total") = String.Format("{0:c}", cartHead.Total_Amount)
End Sub
But if Add to Cart is clicked a second time, the variables update - but with the
values of the first time it was clicked.
I'm guessing it is something with the post back.
Any ideas?
Thanks
page when a function is called that updates them.
I want to keep the "total number of items" and "total amount" for the shopping cart
updated on the Default.aspx page to the current values whenever they are changed.
On the Page_Load of Default.aspx, I load different user controls into the Body like:
Dim control As Control
control = Page.LoadControl("UserControls/selected_page_here.ascx")
pageContentsCell.Controls.Add(control)
items.Text = Session("items")
total.Text = Session("total")
in .aspx:
<td id="pageContentsCell" runat="server">
<asp:Label Runat=server ID="total"></asp:Label>
<asp:Label Runat=server ID="items"></asp:Label>
The problem is when "Add to Cart" is clicked, the variables are not updated
(I don't display the shopping cart when Add to Cart is clicked):
Private Sub Add to Cart
Session("items") = cartHead.Total_Items
Session("total") = String.Format("{0:c}", cartHead.Total_Amount)
End Sub
But if Add to Cart is clicked a second time, the variables update - but with the
values of the first time it was clicked.
I'm guessing it is something with the post back.
Any ideas?
Thanks