Hi, I'm using ASP.NET and a Repeater control to display my data. The data I have is in stored in a List. How would I implement a simple calculator that is affected in real time? Would I have to use AJAX, or is it possible to do it client-side? I'd like the user to be able to change the quantity, with the new price being visible immediately. Seeing as there's a lack of persistence, is there way to prevent constant round-trips to the database to get the price of an item? Thanks
If possible, you can place the price of the item in hidden fields next to the quantity input. Then use simple javascript to calculate the total. Otherwise you can use DynamicPopulate to populate the total using AJAX. But that is still going to get you round trips. You could also do your own ajax which would cache the prices coming back. But that seems the same as placing them in hidden inputs.
You could do this client side with JavaScript or server side via AJAX or through a postback, it just depends how fluid you want the UI to be. What kind of calculations will you need to do, simply monetary 2 decimal values? I'd be tempted to go for a JavaScript solution with a server side postback fallback solution
To prevent a round trip to the server, you'll need some way of supplying the price value on the client side, whether visible or hidden to the client.