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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top