Q: only number in a textbox

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.
 
C

Cliff Harris

I would add a Regular Expression validator control and then write (or find)
some regex that would validate a double)

-Cliff
 
K

Kevin Spencer

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.
 
G

Guest

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top