Implementing a dynamic drop down list box in a web form control in C#
Posted on 2004-11-26
I am developing a web form in C# which has a drop down list box that contains units of measure, i.e. in, ft, mm, m, and km. I have set the selected value to inch. Here is the scenario. Say the end user enters a value of 10 inside the corresponding text box. When the end user changes units to any other unit like mm the conversion works fine, showing the value 254 mm. How do I make this flexible so that if the end user decides to select a unit of measure for example mm, but doesn't want the converted mm value, which in this case is 10 inches, instead the end user wants to override the converted value 25 mm by changing the textbox value. If the end user wants to convert this newly entered value to say meters, it should just be a matter of selecting that from the drop down list box and displaying the value .025 m.
I guess my question would be how do I keep track of the previous selected value at the same time keeping track of the newly selected value to provide for the correct conversion.