|
What is wrong with you ?
1 - the easiest way to do what you want is to parse the values on the keypress event
2 - failing that, I have given you a regex that iwll work in all these cases. I've explained what you need to to to impliment it. Why would anyone bother, after the lengthy thread that exists below to try to explain a simple regex to you, get back on the treadmill and go through it all with you again ? May as well just bang our head against a well as try that.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Don't know why you marked your reply with the joke icon. It's all for real. Even the banging part.
Cheers,
Mircea
"Pay people peanuts and you get monkeys" - David Ogilvy
|
|
|
|
|
Instead of having regular expression I did something like this:
I wrote a javascript function:
function onlyDigits(e)
{
var retKey = true;
var IsTwoDecimal = e.value.indexOf(".");
if (window.event.keyCode < 46 || window.event.keyCode > 57 || window.event.keyCode == 47)
{
window.event.keyCode = 0;
retKey = false;
}
else
{
//This code is used to restrict two decimal cost e.g.= 23.55 is valid
//but cost=45.55.66. is not valid.
if (IsTwoDecimal !=-1)
{
var s=e.value.split(".");
if (window.event.keyCode==46 || s[1].length>=2)
{
window.event.keyCode = 0;
retKey = false;
}
}
}
return (retKey);
}
<input id="txtCost" runat="server" type="text" onkeypress="return onlyDigits(this);" />
Hope this helps u???
|
|
|
|
|
I told her from the start this was a better way to do it, but she would not listen.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Try this
it is solve your question
[-+]?[0-9]*\.?[0-9]*
|
|
|
|
|
why it is validating 8u also.
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Can't understand what u mean??
This Expression is well working for only integer and Float also.
|
|
|
|
|
It means she is stupid. I gave her roughly the same regex, and explained the need to put ^ and $ to make it validate the whole string, but instead she just asked the same question again.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote:
It means she is stupid.
Christian Graus wrote: but instead she just asked the same question again.
And you answer her questions over and over again. You either have the patience of a saint, extremely bored or there is a clause in your contract which states you must attempt to help the stupid. I don't think there is a Sonia post on this forum without a reply from you. You're responses make reading her posts worth it!! And now Jamie has started as well.... She is impervious to it all - it's all wonderful stuff to read!
|
|
|
|
|
Gupta,
Are you doing some self-teaching? Or are you employed? If the latter, may I know which company that might be?
|
|
|
|
|
Hi All,
I am creating editable dropdownlist by taking textbox and dropdownlist. But my problem is that I want textbox to appear in front of dropdownlist but its not working.
Can anyone help me??
|
|
|
|
|
ASP.NET 2.0 wrote: by taking textbox and dropdownlist
How could you ?
ASP.NET 2.0 wrote: But my problem is that I want textbox to appear in front of dropdownlist but its working
That wont help you showing textbox instead of dropdownlist doesn't mean that you are editing the dropdownlist
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hey Sandeep,
I am trying to do something like this :
http://www.codeproject.com/netcf/historycombo.asp
They are using TextBox and Dropdown for this..
Any idea how to do this?? I need to show textbox on dropdown so that when I type anything it shows the list and if I need to select then I can select it from dropdown.
|
|
|
|
|
Sorry never tried but will like to check in different way
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
|
i think u r clicking the edit button and on clicking that the dropdownlist disappears and the textbox appears.if it's that
then simply click the textbox and go to Layout->position->Absolute , It should work i think
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Hi Sonia,
Thanks for reply. I am using the style sheet as:
.textbox
{
position: absolute;
top: 60px;
left: 150px;
height: 20px;
width: 230px;
border: 0px;
font-family:Verdana;
text-align:left;
font-size: 9px;
font-style: normal;
color:#1E438D;
padding-left : 2px;
text-decoration: none;
z-index: 100px;
}
.combo
{
position: absolute;
height: 20px;
width: 250px;
top: 60px;
font-family:Verdana;
text-align:left;
font-size: 9px;
font-style: normal;
color:#1E438D;
padding-left : 2px;
text-decoration: none;
}
and here textbox is appears behind the combo which I dont want. I want the textbox to appear in front of combo so that I can type in something of select anything as I have kept the width of textbox less than combo.
Thanks again...
|
|
|
|
|
I NEVER DID IT LIKE THAT.KEEP THE TEXTBOX A DROPDOWNLIST VISIBLE AND ASSIGN THE DROPDOWNLIST COORDINATES 1 PIXEL LESS TO THE TEXTBOX.AND KEEP IT SAME IN THE CASE OF HEIGHT TOP ETC,AND REPEAT THE PROCESS AT POPULATION OF THE DROP-DOWNLIST CONTROL.I THINK IT SHOULD WORK
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
I want to read excel file in asp.net using Vb.net and also want to write and excel file from the database values. Data can be both numeric and alphabetic.
Thanks in advance
Do good and have good.
|
|
|
|
|
Hi,
Use the Excel Object.It'll help you to read the Excel file and create the Excel file from the database values.
Thanks and Regards
Ganesan.S
Software Engineer
|
|
|
|
|
|
what can e the regular expression string , in order to validate the textbox , to have either whole values or fractional values.
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
*sigh* you just lurch from one question to another, don't you ? I mean, you never actually try to do anything for yourself.
The best way to do this is not a regex, but to validate each character as it's entered ( as all the examples you find on the web will show you ). You only accept the . if the string does not contain one. You obviously accept control characters and numbers, always.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Please do not provide your email address/id. It may be miss use.
|
|
|
|
|
which type value u want to validate or which type value u want restrict.
Piyush Vardhan Singh
|
|
|
|