Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. textbox event

textbox event

Scheduled Pinned Locked Moved ASP.NET
23 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M mylogics

    is there any other way to do this without using javascript bcoz i dont know javascript n how to implement it... :(

    S Offline
    S Offline
    sajjy
    wrote on last edited by
    #11

    javascript is the best way ;) if you have a masterpage , the way that blue boy said is better than mine :) code it like this in your .aspx page :

    the code that blue boy said

    S 1 Reply Last reply
    0
    • S sajjy

      javascript is the best way ;) if you have a masterpage , the way that blue boy said is better than mine :) code it like this in your .aspx page :

      the code that blue boy said

      S Offline
      S Offline
      sajjy
      wrote on last edited by
      #12

      oh i forgot to say something else ;) in your code that you made textboxes you must add this function like this :

      M 1 Reply Last reply
      0
      • M mylogics

        is there any other way to do this without using javascript bcoz i dont know javascript n how to implement it... :(

        P Offline
        P Offline
        padmanabhan N
        wrote on last edited by
        #13

        //as sajjy says function total() { var quantity = document.getElementById('txtqty').value; var price = document.getElementById('txtproductprice').value; document.getElementById('txttotalprice').value = quantity*price; } //call that event in the textbox onblur():

        Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

        M 1 Reply Last reply
        0
        • M mylogics

          hii... i hav 3 textbox named:txtqty,txtproductprice,txttotalprice. i want that when the cursor goes to txttotalprice.the txttotalprice textbox get initialized by the value which is multiple of txtqty and txtproductprice.i hav used the textbox changed event of txttotalprice like this: then i hav coded it like this: protected void txttotalprice_TextChanged(object sender, EventArgs e) { string s = txtqty.Text; string k = txtproductprice.Text; int i = Convert.ToInt32(s); int j = Convert.ToInt32(k); int l = i * j; txttotalprice.Text = Convert.ToString(i); } but it doesnt show any value in txttotalprice...

          S Offline
          S Offline
          Sundeep Ganiga
          wrote on last edited by
          #14

          Dear Guys, You People have left one thing,onblur event(given by padmanabhan) should be written to Two text boxes(txtqty and txtproductprice).In Function we have to Check whether these two TextBoxes are not null and if it is not so , Then multiply and display data in third textbox. Writing an event for third textbox is of no use here. Sundeep Ganiga

          When the only tool you have is a hammer, everything looks like a nail. Come Forth Yourself to Click "Good Answer" for any expected solution. Let us Support our C Project Programmers who provide solutions here.

          S 1 Reply Last reply
          0
          • S sajjy

            oh i forgot to say something else ;) in your code that you made textboxes you must add this function like this :

            M Offline
            M Offline
            mylogics
            wrote on last edited by
            #15

            its not workin... function Calculate() { document.getElementById('<%=txttotalprice.ClientID%>').value= document.getElementById('<%=txtqty.ClientID%>').value * document.getElementById('<%=txtproductprice.ClientID%>').value } wat to do...

            S 1 Reply Last reply
            0
            • P padmanabhan N

              //as sajjy says function total() { var quantity = document.getElementById('txtqty').value; var price = document.getElementById('txtproductprice').value; document.getElementById('txttotalprice').value = quantity*price; } //call that event in the textbox onblur():

              Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

              M Offline
              M Offline
              mylogics
              wrote on last edited by
              #16

              hiii onblur event does not exist... oninit(),onload(),onunlload,ontextchanged(),onprerender()...exist which event shud i use....

              1 Reply Last reply
              0
              • M mylogics

                its not workin... function Calculate() { document.getElementById('<%=txttotalprice.ClientID%>').value= document.getElementById('<%=txtqty.ClientID%>').value * document.getElementById('<%=txtproductprice.ClientID%>').value } wat to do...

                S Offline
                S Offline
                sajjy
                wrote on last edited by
                #17

                change it to this one :

                function Calculate()
                {
                document.getElementById('<%=txttotalprice.ClientID%>').value=
                document.getElementById('<%=txtqty.ClientID%>').value *
                document.getElementById('<%=txtproductprice.ClientID%>').value

                }

                notice that javascript is Case Sencetive ! :-\

                M 1 Reply Last reply
                0
                • S sajjy

                  change it to this one :

                  function Calculate()
                  {
                  document.getElementById('<%=txttotalprice.ClientID%>').value=
                  document.getElementById('<%=txtqty.ClientID%>').value *
                  document.getElementById('<%=txtproductprice.ClientID%>').value

                  }

                  notice that javascript is Case Sencetive ! :-\

                  M Offline
                  M Offline
                  mylogics
                  wrote on last edited by
                  #18

                  hiii.... sir there is no onfocus event.... the events are.. oninit(),onload(),onunload(),onprerender(),ontextchanged()... which event shud i use...

                  S 1 Reply Last reply
                  0
                  • S Sundeep Ganiga

                    Dear Guys, You People have left one thing,onblur event(given by padmanabhan) should be written to Two text boxes(txtqty and txtproductprice).In Function we have to Check whether these two TextBoxes are not null and if it is not so , Then multiply and display data in third textbox. Writing an event for third textbox is of no use here. Sundeep Ganiga

                    When the only tool you have is a hammer, everything looks like a nail. Come Forth Yourself to Click "Good Answer" for any expected solution. Let us Support our C Project Programmers who provide solutions here.

                    S Offline
                    S Offline
                    sajjy
                    wrote on last edited by
                    #19

                    yes you are right !!! :laugh: but first we can let him to create his first javascript , then he can do any thing he wants ;)

                    M 1 Reply Last reply
                    0
                    • M mylogics

                      hiii.... sir there is no onfocus event.... the events are.. oninit(),onload(),onunload(),onprerender(),ontextchanged()... which event shud i use...

                      S Offline
                      S Offline
                      sajjy
                      wrote on last edited by
                      #20

                      hehehe i know :-D visual studio is stupid ;) javascript runs at client computers , so don`t worry :) just use it :cool:

                      M 1 Reply Last reply
                      0
                      • S sajjy

                        hehehe i know :-D visual studio is stupid ;) javascript runs at client computers , so don`t worry :) just use it :cool:

                        M Offline
                        M Offline
                        mylogics
                        wrote on last edited by
                        #21

                        hiii great finally it worked... thanks alot... thank you very much sir specially sajjy,padmanabhan and blue boy... Best Regards pari....

                        B 1 Reply Last reply
                        0
                        • M mylogics

                          hiii great finally it worked... thanks alot... thank you very much sir specially sajjy,padmanabhan and blue boy... Best Regards pari....

                          B Offline
                          B Offline
                          Blue_Boy
                          wrote on last edited by
                          #22

                          You are welcome.


                          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

                          1 Reply Last reply
                          0
                          • S sajjy

                            yes you are right !!! :laugh: but first we can let him to create his first javascript , then he can do any thing he wants ;)

                            M Offline
                            M Offline
                            mylogics
                            wrote on last edited by
                            #23

                            thanks...alll

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups