Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Afternoon friends,
I am developing website in Asp.net 3.5 framework visual studio 2008.
What I want to achieve is that I have 1 listview in that I am displaying some products and its price so now I want to allow customer to enter the quantity in the text box and when he tabs the quantity then the price and quantity should get multiplied,I tried this on textchanged of the text box but the event is not getting fired.please help me.
Best Regards,
Santosh More
Posted

implement some javascript calculate the price and quantity. By firing the script on the quantity text box onBlur event you could then update the prices accordingly.

<input type="text" id="txtQuantity" onblur="calcualteValues()">
 
Share this answer
 
Comments
SantoshRohinSantosh 29-May-12 4:22am    
Thanks for the solution but there can be no of products ,so should I use the scrip in each text box???
Please elaborate the solution.
db7uk 29-May-12 4:38am    
yes add the script to each product but pass the id of the textbox into the script:
<input type="text" id="txtQuantity1" önblur="calcualteValues(txtQuantity1.ClientId)"> or something similar.

Your javascript should then be function(idOfControl){};
BobJanova 29-May-12 6:39am    
5 for this because server-side handling of TextChanged is a terrible user experience and doing it with client-side script is the correct answer.

ed: even if you need some server-side information, you should do it with client script and AJAX
db7uk 29-May-12 6:59am    
Thanks. things like this should always be done client side as you said. Takes too much pain to do it server side and is slower.
try changing the autopostback to true ..
Click the textbox and change the Autopostback to true .. Then it will fire the event..
 
Share this answer
 
Comments
SantoshRohinSantosh 29-May-12 4:59am    
Ya i have tried that Dhanushka but it is not working.
Dhanushka Madushan lk 29-May-12 5:04am    
U have to press enter after entering the quantity to fire the TextChanged event..what do mean by not working??
SantoshRohinSantosh 29-May-12 5:45am    
Ya I have tried that as well ,I mean the event is not getting fired,I have debug it but the execution is not coming in this event. please help
Dhanushka Madushan lk 29-May-12 5:51am    
If u can put that piece of code here it will be more helpful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900