Localization Problem with RadNumericTextBox
RadNumericTextBox is a really great server control provided by telerik.com. This is an input control which only accepts numeric inputs. Not only that, it also support formatting like it adds automatically commas and decimals.
You can set its formatting options based on your own Culture setting or your own preferred one. But there seems to be one problem on this one, one Culture settings for instance is the Germany settings. In case you don't know Germany Culture settings is reverse of US Culture when it comes to Thousands and Decimal separation. You see Thousands is separated by the "." (period) and Decimals is separated by a "," (comma) which is really the opposite one.
RadNumericTextBox handles formatting by Culture setting quite very well but if you would access like, lets say we have RadNumericTextBox1, if you want to get the text, you can simply just access its property RadNumericTextBox1.Text. But the problem is if the user's Culture setting is Germany and he enters "1.000" (this is read as one thousand in Germany) and if you will get the RadNumericTextBox1.Text value you would get "1,000" instead of "1.000". This is really a big problem because if you would call lets say the method decimal.Parse( RadNumericTextBox1.Text) you would get a different value instead of "1,000" because it seems that decimal.Parse() method was localized as well which means if you would call decimal.Parse( RadNumericTextBox1.Text) you would get "1" (one) as the value instead of "1,000" (one thousand).
So how would you solve this problem? The solution is just simple and this applies as well to other 3rd party controls that have the same problem. You just simply use the US Culture when you parse it.
CultureInfo culture = new CultureInfo("en-US");
decimal weight = decimal.Parse(RadNumericTextBox1.Text, culture.NumberFormat); 