0

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

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()
        Me.UpdatePanel1.Update()
    End Sub

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

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by vuyiswamb
0

Set AutoPostBack=True of Textbox8 control.

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

0

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.