Solved

Unable to get textbox to update with value from database

Posted on 2008-06-24
2
589 Views
Last Modified: 2008-07-21
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.

Any suggestions?
0
Comment
Question by:kwienken
2 Comments
 
LVL 21

Accepted Solution

by:
naspinski earned 500 total points
ID: 21863824
you have to explicitly change the textbox, it will not rebind to data unless you specify that it must.  Or you could just put the new value in there when you test for validity.
0
 

Author Comment

by:kwienken
ID: 21870576
The problem is that it's not bound to a data source. It should be but I didn't how to in this instance. I've fixed my problem for now by adding a random number to the text box ID. I would still like to know why TextBox.Text = newValue doesn't change what the user sees after an AsyncPostBack though.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now