The problem I am having is that I need to track a number on an asp.net website. When a forward and backward button is clicked, the number should increase or decrease by one. The result I am getting is that when the button is clicked the first time nothing happens. Then the second time it is clicked the textbox displaying the current value of the session variable is finally updated. Another thing that happens is if I click the add button twice then click the minus button....the number will continue to increment. Its like the displayed value is one click behind.
What do I need to do to update the text box immediately after the add/minus button is clicked and not be a click behind?
I am using VS 2008.
Thanks for the help.
Partial Class _Default
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Session("counter") = 1
TextBox1.Text = Session("counter")
Protected Sub btnSubtract_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubtract.Click
Session("counter") -= 1
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Session("counter") += 1