Convert string to decimal retaining the exact input format
<p>I'm sure this is a piece of cake but I'm really struggling with something that seems trivial.</p>

<p>I need to check the inputted text of a textbox on the form submit and check to see if it's within a desired range (I've tried a Range Validator but it doesn't work for some reason so I'm trying to do this server-side).</p>

<p>What I want to do is:</p>

<p>Get the value inputted (eg. 0.02), replace the commas and periods, convert that to a decimal (or double or equivalent) and check to see if it's between 0.10 and 35000.00.</p>

<p>Here's what I have so far:</p>

<pre><code>string s = txtTransactionValue.Text.Replace(",", string.Empty).Replace(".", string.Empty);
        decimal transactionValue = Decimal.Parse(s);
        if (transactionValue &gt;= 0.10M &amp;&amp; transactionValue &lt;= 35000.00M) // do something
</code></pre>

<p>If I pass 0.02 into the above, transactionValue is 2. I want to retain the value as 0.02 (ie. do no format changes to it - 100.00 is 100.00,  999.99 is 999.99)</p>

<p>Any ideas?</p>

<p>Thanks in advance,
Brett</p>
