Unable to get textbox to update with value from database
Posted on 2008-06-24
I have a cart view page that has a quantity text box control for each product in the cart. There is an update hyperlink next to each quantity text box that triggers an asyncpostback. The cart contents is in an update panel and builds on page load. The update to the database takes place in the page load only on an asyncpostback and prior to the cart contents being pulled from the database and rendered. The quantity updates properly in the database and all totals update in the cart contents table but the quantity textbox keeps the user entered value.
I only realized this because if a user enters say -5 for a quantity then I change the quantity to one and display a message stating that the quantity was invalid. The database gets updated to quantity of 1, all totals show correct pricing, and if I generate a new textbox under the original one it gets a value of 1 but the -5 remains in the original text box.