Hi all,

I'm designing a web page in ASPX. I have a few textboxes where the user enters the number of items, and a label that shows what they would currently pay if they checked out at that moment. I need help using a UpdatePanel to refresh the label when they make a change. I have a custom function called Calc() that calulates and returns the amount they owe.. So, for example, when the user changes the text in textbox8, I want the label to be updated with the new value of calc(). Heres my code for the updatepanel/label:

<asp:ScriptManager ID="ScriptManager1" runat="server">
          <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                  <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="20pt" 
              style="text-align: center" Text="You owe: $0.00"></asp:Label>

Then, in my Textbox8.TextChanged method:

Private Sub TextBox8_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
        Me.Label1.Text = "You owe: " & Calc()
    End Sub

But that doesnt refresh the label. What am I doing wrong?

7 Years
Discussion Span
Last Post by vuyiswamb

Set AutoPostBack=True of Textbox8 control.

I did, but now it reloads the entire page, not just the UpdatePanel


What you need to do is to add triggers in your update panel and select the textbox and select the correct event.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.