Q: only number in a textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I am trying to allow only number in a textbox. I need to put it into
database as double. So Convert.ToDouble should not fail. How should I do this?
Thanks,
Jim.
 
I would add a Regular Expression validator control and then write (or find)
some regex that would validate a double)

-Cliff
 
Use validation, and make sure that the value in the field is numeric. Any
numeric value can be converted to a double.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
Just create a CompareValidation control set the type to Double and the
Operator to DataTypeCheck

<asp:CompareValidator id="CompareValidator1" runat="server"
ErrorMessage="CompareValidator" Type="Double"
Operator="DataTypeCheck"></asp:CompareValidator>
 
Back
Top