i have a textbox in a c# asp.net webform. i am using a
regularexpressionvalidator control to validate the textbox. only whole nos.
and currencies are allowed in it (example: 51, 36.3 and 19.95, it should
allow whole nos., one decimal pt. and 2 decimal pt.). in my
regularexpressionvalidator control property window, i couldnt find the right
validation expression to use to make it work properly.
thanks in advance. 6 2303
Give this one a try:
^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$
Brendan
"Newbie" wrote: i have a textbox in a c# asp.net webform. i am using a regularexpressionvalidator control to validate the textbox. only whole nos. and currencies are allowed in it (example: 51, 36.3 and 19.95, it should allow whole nos., one decimal pt. and 2 decimal pt.). in my regularexpressionvalidator control property window, i couldnt find the right validation expression to use to make it work properly.
thanks in advance.
it's not allowing whole nos.
"Brendan Grant" wrote: Give this one a try:
^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$
Brendan
"Newbie" wrote:
i have a textbox in a c# asp.net webform. i am using a regularexpressionvalidator control to validate the textbox. only whole nos. and currencies are allowed in it (example: 51, 36.3 and 19.95, it should allow whole nos., one decimal pt. and 2 decimal pt.). in my regularexpressionvalidator control property window, i couldnt find the right validation expression to use to make it work properly.
thanks in advance.
Oops, then we need to throw in an or and the real number pattern of
([-]|[0-9])[0-9]* resulting in:
^(([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9])|(([-]|[0-9])[0-9]*)+$
Brendan
"Newbie" wrote: it's not allowing whole nos.
"Brendan Grant" wrote:
Give this one a try:
^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$
Brendan
"Newbie" wrote:
i have a textbox in a c# asp.net webform. i am using a regularexpressionvalidator control to validate the textbox. only whole nos. and currencies are allowed in it (example: 51, 36.3 and 19.95, it should allow whole nos., one decimal pt. and 2 decimal pt.). in my regularexpressionvalidator control property window, i couldnt find the right validation expression to use to make it work properly.
thanks in advance.
it's not allowing x.xx such as 5.25
"Brendan Grant" wrote: Oops, then we need to throw in an or and the real number pattern of ([-]|[0-9])[0-9]* resulting in:
^(([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9])|(([-]|[0-9])[0-9]*)+$
Brendan
"Newbie" wrote:
it's not allowing whole nos.
"Brendan Grant" wrote:
Give this one a try:
^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$
Brendan
"Newbie" wrote:
> i have a textbox in a c# asp.net webform. i am using a > regularexpressionvalidator control to validate the textbox. only whole nos. > and currencies are allowed in it (example: 51, 36.3 and 19.95, it should > allow whole nos., one decimal pt. and 2 decimal pt.). in my > regularexpressionvalidator control property window, i couldnt find the right > validation expression to use to make it work properly. > > thanks in advance. >
I apologize again, it seems that I missed a character when updating the regex
string for you, namely a *, so we go from:
^(([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9])|(([-]|[0-9])[0-9]*)+$
to
^(([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*)|(([-]|[0-9])[0-9]*)+$
Brendan
"Newbie" wrote: it's not allowing x.xx such as 5.25
"Brendan Grant" wrote:
Oops, then we need to throw in an or and the real number pattern of ([-]|[0-9])[0-9]* resulting in:
^(([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9])|(([-]|[0-9])[0-9]*)+$
Brendan
"Newbie" wrote:
it's not allowing whole nos.
"Brendan Grant" wrote:
> Give this one a try: > > ^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$ > > Brendan > > > "Newbie" wrote: > > > i have a textbox in a c# asp.net webform. i am using a > > regularexpressionvalidator control to validate the textbox. only whole nos. > > and currencies are allowed in it (example: 51, 36.3 and 19.95, it should > > allow whole nos., one decimal pt. and 2 decimal pt.). in my > > regularexpressionvalidator control property window, i couldnt find the right > > validation expression to use to make it work properly. > > > > thanks in advance. > >
its now working:
^([$]?\d+(\.\d{2})?$)|([$]?\d+(\.\d{1})?$)
thanks
"Brendan Grant" wrote: Oops, then we need to throw in an or and the real number pattern of ([-]|[0-9])[0-9]* resulting in:
^(([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9])|(([-]|[0-9])[0-9]*)+$
Brendan
"Newbie" wrote:
it's not allowing whole nos.
"Brendan Grant" wrote:
Give this one a try:
^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$
Brendan
"Newbie" wrote:
> i have a textbox in a c# asp.net webform. i am using a > regularexpressionvalidator control to validate the textbox. only whole nos. > and currencies are allowed in it (example: 51, 36.3 and 19.95, it should > allow whole nos., one decimal pt. and 2 decimal pt.). in my > regularexpressionvalidator control property window, i couldnt find the right > validation expression to use to make it work properly. > > thanks in advance. > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alex Bink |
last post by:
Hi,
I have a validating event on a textbox in which I want to prevent the user
to leave the textbox without entering the right data. Only if he clicks on
another specific control he is allowed...
|
by: Chris Dunaway |
last post by:
I have a form with a textbox and numerous panels, buttons and other
controls. I have handled the textbox Validating and Validated events. The
textbox will hold a filename. In the validating...
|
by: Matthew |
last post by:
All,
I have searched google and the newsgroups but can't find anything the
same as what I am experiencing (though I may have missed something).
I have controls (textboxes) within UserControls...
|
by: Gary Shell |
last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852...
|
by: Bruce HS |
last post by:
I'd like to call my ancestor Validation Function every time any control on a
Win Form generates a Validating or Validated event. I'm using VB.
I've extended Textbox, for instance, to have its...
|
by: Ryan |
last post by:
I have a windows form that I want to force validation on controls (text
boxes) when the user clicks a "Save" button. The only way I've found to do
this is to cycle through every control and call...
|
by: ameen.abdullah |
last post by:
Hi Guys,
I have a textbox in windows form that should only accept alphabets,
numbers, spaces and underscore. If the textbox contains anyother
character it should display a msg at the time of...
|
by: TheSteph |
last post by:
Hi Experts !
I have a Winform Program in C# / .NET 2.0
I would like to ensure that a value in a TextBox is a valid Int32 when user
get out of it (TextBox loose focus)
|
by: =?Utf-8?B?bGpsZXZlbmQy?= |
last post by:
I've noticed that controls do not raise a Validating event if they are
contained in a ToolStripDropDown via a ToolStripControlHost item. Please run
the following sample and follow the instructions...
|
by: Peted |
last post by:
I have an amazing problem which i think i have no hope of solving
Im working with a c# dot net module that is hosted by and runs under a
delphi form envrioment. Dont ask me how this insanity has...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |