Skip to main content
2 of 2
deleted 1 characters in body
kevin cline
  • 33.9k
  • 3
  • 73
  • 143

In a slightly more complex situation, I decided to use AJAX to make sure the calculation is only done in one place, i.e. on the server. Coding the same calculation twice (on the server in C#, on the browser in JavaScript) is code duplication and might negatively affect maintainance; making use of a property of the calulation like you proposed seems even more dangerous because once someone decides that from now on, the formula has to be

 B = A * 1.05 + C

your code will create subtle errors and probably cause a lot of headaches.

user281377
  • 28.5k
  • 5
  • 79
  • 131