Thanks Suresh for your code but it will only work if JavaScript is enabled. What's your fallback for when JavaScript is not available? Why don't you do this in server-side code?
Hi,for this very simple solutions is that, u use the ajax filter control and its syn. is as follow and i am using this one .<ajax:FilteredTextBoxExtender ID="ftbAmount" runat="server" TargetControlID="txtAmount" FilterType="Custom, Numbers" ValidChars="." />
Hi,
I already post this code above.... First try to read posts and then comment.
suresh dasar...
Contributor
3606 Points
743 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
May 04, 2011 09:10 AM|LINK
hi taffylewis,
check this post here i explained clearly how to restrcit user to enter only numbers in textbox using javascript.
http://aspdotnet-suresh.blogspot.com/2010/12/how-to-restrict-user-to-enter-only.html
in this post textbox allow only numbers no spaces and no other characters it will helps you
Please "Mark as Answer" If post helps you
matifnadeem
Contributor
4710 Points
1111 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
May 06, 2011 11:38 AM|LINK
Thanks Suresh for your code but it will only work if JavaScript is enabled. What's your fallback for when JavaScript is not available? Why don't you do this in server-side code?
For Example
its support letters and-+() only no alphabets or space
M Atif Nadeem
Mark as Answer if you got right thing
Read my blog | Follow me on LinkedIn
matifnadeem
Contributor
4710 Points
1111 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
Jun 03, 2011 04:40 AM|LINK
Hi,
if you got your answer then click this thread as answer to any post which helps you ................
M Atif Nadeem
Mark as Answer if you got right thing
Read my blog | Follow me on LinkedIn
PakSoftSolut...
Member
8 Points
4 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
Jun 16, 2011 10:35 AM|LINK
Hi,
for this very simple solutions is that, u use the ajax filter control and its syn. is as follow and i am using this one .
<ajax:FilteredTextBoxExtender ID="ftbAmount" runat="server" TargetControlID="txtAmount" FilterType="Custom, Numbers" ValidChars="." />
matifnadeem
Contributor
4710 Points
1111 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
Jun 16, 2011 10:41 AM|LINK
Hi,
I already post this code above.... First try to read posts and then comment.
Happy Coding..:)
M Atif Nadeem
Mark as Answer if you got right thing
Read my blog | Follow me on LinkedIn
PakSoftSolut...
Member
8 Points
4 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
Jun 16, 2011 11:20 AM|LINK
ohoo, ok and sorry that i thift ur code and logic.
awais_487
Member
2 Points
1 Post
Re: Regular Expression Validator - Numbers only no letters no spaces
Jul 14, 2011 10:57 PM|LINK
To restrict everything including Blanks and Spaces and to allow only numbers use below Regex
Regex NumOnly = new Regex("\\A[\\d]\\Z");
karthickredd...
Member
2 Points
1 Post
Re: Regular Expression Validator - Numbers only no letters no spaces
Aug 02, 2011 05:34 PM|LINK
Only numbers can enter into that Textbox We can use Regular expression validator for this:
In the validation expression property keep ^\d+$.
ROHIT SOOD
Member
527 Points
448 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
Oct 18, 2011 11:32 AM|LINK
check out this one..
its for numbers and some mathematical operators...
u can remove the mathematical operators if not required..
srinanthuram
Contributor
6800 Points
1549 Posts
Re: Regular Expression Validator - Numbers only no letters no spaces
Feb 08, 2012 11:24 AM|LINK
hi
"^\d+$"
try it
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Please Enter Only Numbers" Style="z-index: 101; left: 424px; position: absolute;
top: 285px" ValidationExpression="^\d+$" ValidationGroup="check"></asp:RegularExpressionValidator>
thank u