In asp.net,When I type letter in textbox, textbox doesn't show this letter and save in variable and when i type digit in textbox, textbox shows this digit and store in another variable. How should i do?
calculator in asp.net
Collapse
X
-
posted in the ASP forum on accident. I'll move this post to the ASP.NET forum. For future reference, ASP uses VBScript, and .asp files. ASP.NET can use any of the .NET languages (which don't include VBScript) and .aspx files. The two are not compatible.
JaredComment
-
Do you have a Button for "+", "-", "*" etc on the page?
If so, when the user types one of these characters into the TextBox you will call the __doPostback() method for the appropriate corresponding Button.
You will have to implement a JavaScript method that is called during the onkeyup method for the <input type="text"> HTML element that is the ASP.NET TextBox element. This method will return true if the user typed a number, or a "." (only if the string in the TextBox doesn't already have a ".") this will allow them to enter the correct input (Please also allow the user to hit the backspace key etc.). The method will return false for any other data inputted (this will prevent the data from being entered into the TextBox). This method will check if the user entered a mathematical operation ("+", "-", "*"...) and if they did will call the __doPostback method for the corresponding button. This will cause the page to postback to the server so that you can handle the event server side.
-FrinnyComment
Comment