calculator in asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nora hyun
    New Member
    • Jul 2010
    • 3

    calculator in asp.net

    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?
    Last edited by jhardman; Jul 15 '10, 02:18 PM. Reason: moved to asp.net forum, accidentally posted in "classic ASP"
  • nora hyun
    New Member
    • Jul 2010
    • 3

    #2
    calculator in asp.net

    I'm making a calculator in asp.net and i have a problem that how can i distinguish textbox data that it was from button click or type data and when i type sign(+-*/) in textbox , sign not displayed but saved. How can i implement?

    Comment

    • nora hyun
      New Member
      • Jul 2010
      • 3

      #3
      distinguish input in textbox

      is it possible to distinguish input by typing or by button clicking when enter data in textbox in asp.net?

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        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.

        Jared

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          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.

          -Frinny

          Comment

          Working...