Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to capture data on form without submit button 2

Status
Not open for further replies.

jupiter8

Programmer
Nov 22, 2002
72
0
0
GB
I am writing a shopping basket and want to basket total to be updated everytime someone changes the quantity without having to click on a 'update basket' button.

So I have made 'Autopostback' true for each quantity field. The quantity fields are added dynamically so I don't know how many there will be and I want to know is there a way to capture the changes without writing a onchange event for each button.

I.e. can I loop through the form and update the quantities on postback, my attempts so far have failed as I can't work out how to run the code on postback with a button triggering the event.
 
Yeah sure. Either rebuild the dynamically created controls and retrieve their text value or look at Request.Form.
 
I would appear that I could solve this problem by using the ontextchanged to fire a sub routine. But I can not see how I might add such an event to the TextBox control dynamically from the code behind page.

Any Ideas
 
Use AddHandler to add handles to dynamically creted controls
 
Thanks that was just what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top