Search code examples
c#.nettextboxautopostbacktextchanged

Textbox TextChangedEvent not firing?


I'm working on a basic eCommerce site and I am looking for some help regarding a live calculation that needs to be made when the user enters a numeric value into a text box.

Currently I have set the calculation the happen in a TextChanged event tied to the textbox but this does not seem to be working??? I am wondering if I need to set auto postback to true but I would like the avoid reloading the page if it can be helped!!!

Any help would be great! Here is the code behind the button

 protected void TB_Quantity_TextChanged(object sender, EventArgs e)
{
    LB_price.Text = 
       (int.Parse(ViewState["Price"].ToString()) * 
          int.Parse(TB_Quantity.Text.Trim())).ToString();
}

Solution

  • You can not fire an asp.net event without post back the page to the server.

    However, if you need the posting back to be invisible to the user, you may need to use Partial Page Update.