How to Invoke keypress event in web Application
-
hi sir, i want to know the keypress event in web application with the language c# for a textbox.textbox should have only integer value.send me javascript also if there is any use of javascript.
-
hi sir, i want to know the keypress event in web application with the language c# for a textbox.textbox should have only integer value.send me javascript also if there is any use of javascript.
-
hi sir, i want to know the keypress event in web application with the language c# for a textbox.textbox should have only integer value.send me javascript also if there is any use of javascript.
sir i want that code please
-
sir i want that code please
write this code in page load txt.Attributes.Add("onkeypress", "javascript:return DecimalLength(Event)"); and in page source:- function DecimalLength(e) { var KeyChar = (e.which) ? e.which : e.keyCode; if(KeyChar > 57 && KeyChar < 48) { if(window.event) e.returnValue = false; else e.preventDefault(); } } //Check keycode for numbers. Hope this will help you...........
Life Is Beautiful
-
hi sir, i want to know the keypress event in web application with the language c# for a textbox.textbox should have only integer value.send me javascript also if there is any use of javascript.
vikas shukla wrote:
i want to know the keypress event in web application with the language c# for a textbox.textbox should have only integer value.send me javascript also if there is any use of javascript.
What's clear here, is that you are absolutely lost, and completely clueless about what you're doing. If you knew anything about ASP.NET, you'd know what use javascript is, and why no C# code will exist for a keypress event. I suggest you buy a basic book and work through it.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
write this code in page load txt.Attributes.Add("onkeypress", "javascript:return DecimalLength(Event)"); and in page source:- function DecimalLength(e) { var KeyChar = (e.which) ? e.which : e.keyCode; if(KeyChar > 57 && KeyChar < 48) { if(window.event) e.returnValue = false; else e.preventDefault(); } } //Check keycode for numbers. Hope this will help you...........
Life Is Beautiful
ais07 wrote:
if(KeyChar > 57 && KeyChar < 48)
hmm...... So, if the number is greater than 57 and AT THE SAME TIME is less than 48......
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
ais07 wrote:
if(KeyChar > 57 && KeyChar < 48)
hmm...... So, if the number is greater than 57 and AT THE SAME TIME is less than 48......
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
:laugh: :laugh: Silly mistakes....
Abhishek Sur My Latest Articles Working with Excel using MDAC
Basics on LINQ and Lambda Expressions
Create .NET Templates -
hi sir, i want to know the keypress event in web application with the language c# for a textbox.textbox should have only integer value.send me javascript also if there is any use of javascript.
you mean it will postback to the server on each keypress?? :omg: :omg:
Abhishek Sur My Latest Articles Working with Excel using MDAC
Basics on LINQ and Lambda Expressions
Create .NET Templates -
you mean it will postback to the server on each keypress?? :omg: :omg:
Abhishek Sur My Latest Articles Working with Excel using MDAC
Basics on LINQ and Lambda Expressions
Create .NET TemplatesHe has absolutely no idea about web development, obviously.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
:laugh: :laugh: Silly mistakes....
Abhishek Sur My Latest Articles Working with Excel using MDAC
Basics on LINQ and Lambda Expressions
Create .NET TemplatesYeah, it's not a big deal, except that the OP is obviously clueless, and would be unable to debug this code.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
write this code in page load txt.Attributes.Add("onkeypress", "javascript:return DecimalLength(Event)"); and in page source:- function DecimalLength(e) { var KeyChar = (e.which) ? e.which : e.keyCode; if(KeyChar > 57 && KeyChar < 48) { if(window.event) e.returnValue = false; else e.preventDefault(); } } //Check keycode for numbers. Hope this will help you...........
Life Is Beautiful
sir it's not working.can we do this from code behind.
-
sir it's not working.can we do this from code behind.
vikas shukla wrote:
sir it's not working
No, for the reason I stated. A number can't be > 57 AND less than 48 at the same time.
vikas shukla wrote:
can we do this from code behind.
I'm sorry, but you may well be too dumb to do this at all. Do you REALLY want your page to reload itself every time someone presses a key ? Thankfully Microsoft realises how retarded that would be, so they don't offer support for it.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
He has absolutely no idea about web development, obviously.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
yes. I agree. Should read basic books on ASP.NET :) :)
Abhishek Sur My Latest Articles Working with Excel using MDAC
Basics on LINQ and Lambda Expressions
Create .NET Templates -
ais07 wrote:
if(KeyChar > 57 && KeyChar < 48)
hmm...... So, if the number is greater than 57 and AT THE SAME TIME is less than 48......
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Sir, This code which I had suggested is only for reference not to copy as it is.
Life Is Beautiful
Yeah, well, the guy asking you is as dumb as a post, he's going to copy and paste it, and have no idea how to fix it. I know you were just showing the concept, and I've made dumber mistakes, I am not taking a shot at you. I just could see problems brewing because the OP is too dumb to know what this code does, he sure as hell can't debug it.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.