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. Button click event

Button click event

Scheduled Pinned Locked Moved ASP.NET
question
11 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 Offline
    M Offline
    miniThomas
    wrote on last edited by
    #1

    When I click once on button the event is not fired..when I click twice then only the event is fired...what culd the proble b? thanx

    C V 2 Replies Last reply
    0
    • M miniThomas

      When I click once on button the event is not fired..when I click twice then only the event is fired...what culd the proble b? thanx

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Hard to say, without seeing any code. No way does a button not fire until you click it twice.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      M 1 Reply Last reply
      0
      • C Christian Graus

        Hard to say, without seeing any code. No way does a button not fire until you click it twice.

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        M Offline
        M Offline
        miniThomas
        wrote on last edited by
        #3

        The code is in C# I have written a javascript code on click event of button following is the code: Also once condition is true i hv displayed a grid view getting data from db function checkDotOnly() { if (document.form1.txtcustomerName.length!=0) { if((document.form1.txtcustomerName.value==".")||(document.form1.txtcustomerName.value==". ")||(document.form1.txtcustomerName.value==" ")) { alert("Please Enter Valid Customer Name."); /*document.form1.lblErrMsg.value="Please Enter Valid Customer Name."; document.form1.lblErrMsg.disabled=false;*/ return false; } return true; } return true; } thanx

        N B 2 Replies Last reply
        0
        • M miniThomas

          When I click once on button the event is not fired..when I click twice then only the event is fired...what culd the proble b? thanx

          V Offline
          V Offline
          vidya p nair
          wrote on last edited by
          #4

          You might have coded under button_doubleClick You right the code under button_Click Try it out:):rose:

          Vidya

          M N 2 Replies Last reply
          0
          • V vidya p nair

            You might have coded under button_doubleClick You right the code under button_Click Try it out:):rose:

            Vidya

            M Offline
            M Offline
            miniThomas
            wrote on last edited by
            #5

            Hi Vidya, The code is written On Click event thanx

            M 1 Reply Last reply
            0
            • V vidya p nair

              You might have coded under button_doubleClick You right the code under button_Click Try it out:):rose:

              Vidya

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              vidya.p.nair wrote:

              You might have coded under button_doubleClick

              It's ASP.NET. Not windows app. In this you won't get double click event.:confused::confused:


              My Website | Ask smart questions

              M 1 Reply Last reply
              0
              • M miniThomas

                The code is in C# I have written a javascript code on click event of button following is the code: Also once condition is true i hv displayed a grid view getting data from db function checkDotOnly() { if (document.form1.txtcustomerName.length!=0) { if((document.form1.txtcustomerName.value==".")||(document.form1.txtcustomerName.value==". ")||(document.form1.txtcustomerName.value==" ")) { alert("Please Enter Valid Customer Name."); /*document.form1.lblErrMsg.value="Please Enter Valid Customer Name."; document.form1.lblErrMsg.disabled=false;*/ return false; } return true; } return true; } thanx

                N Offline
                N Offline
                N a v a n e e t h
                wrote on last edited by
                #7

                ouch.. Very tough to read that script. Let me make it more clear

                function checkDotOnly()
                {
                if (document.form1.txtcustomerName.length!=0)
                {
                if((document.form1.txtcustomerName.value==".") ||(document.form1.txtcustomerName.value==". ") ||(document.form1.txtcustomerName.value==" "))
                {
                alert("Please Enter Valid Customer Name.");
                return false;
                }
                return true;
                }
                return true;
                }

                I think last two true you are returning. That is making problem. Try writting this like

                function checkDotOnly()
                {
                if (document.form1.txtcustomerName.length!=0)
                {
                if((document.form1.txtcustomerName.value==".") ||(document.form1.txtcustomerName.value==". ") ||(document.form1.txtcustomerName.value==" "))
                {
                alert("Please Enter Valid Customer Name.");
                return false;
                }
                else
                return true;
                }
                else
                return true;
                }


                My Website | Ask smart questions

                1 Reply Last reply
                0
                • M miniThomas

                  The code is in C# I have written a javascript code on click event of button following is the code: Also once condition is true i hv displayed a grid view getting data from db function checkDotOnly() { if (document.form1.txtcustomerName.length!=0) { if((document.form1.txtcustomerName.value==".")||(document.form1.txtcustomerName.value==". ")||(document.form1.txtcustomerName.value==" ")) { alert("Please Enter Valid Customer Name."); /*document.form1.lblErrMsg.value="Please Enter Valid Customer Name."; document.form1.lblErrMsg.disabled=false;*/ return false; } return true; } return true; } thanx

                  B Offline
                  B Offline
                  ballameharmurali
                  wrote on last edited by
                  #8

                  hello miniThomas, Call that javascript in the Buton in onclientclick....It will work it is client side event..... ok byeee

                  1 Reply Last reply
                  0
                  • N N a v a n e e t h

                    vidya.p.nair wrote:

                    You might have coded under button_doubleClick

                    It's ASP.NET. Not windows app. In this you won't get double click event.:confused::confused:


                    My Website | Ask smart questions

                    M Offline
                    M Offline
                    miniThomas
                    wrote on last edited by
                    #9

                    Hi Guys, here is code: function checkDotOnly() { if (document.form1.txtcustomerName.length!=0) { if((document.form1.txtcustomerName.value==".")||(document.form1.txtcustomerName.value==". ")||(document.form1.txtcustomerName.value==" ")) { alert("Please Enter Valid Customer Name."); /*document.form1.lblErrMsg.value="Please Enter Valid Customer Name."; document.form1.lblErrMsg.disabled=false;*/ return false; } return true; } return true; } protected void imgbtnSearch_Click(object sender, ImageClickEventArgs e) { if (RadioButtonList1.SelectedValue.ToString() == "") { lblMsg.Text = ""; lblErrMsg.Visible = true; lblErrMsg.Text = "Please Select One Option."; PnlSearchResults.Visible = false; } else { if (RadioButtonList1.SelectedIndex.ToString() == "0" && ddlOrderNo.SelectedItem.Value == "-1") { lblMsg.Text = ""; lblErrMsg.Visible = true; lblErrMsg.Text = "Please Select Order Number."; PnlSearchResults.Visible = false; } else { lblErrMsg.Visible = false; fillSearchResults(); } if (RadioButtonList1.SelectedIndex.ToString() == "1") { if (txtcustomerName.Text == "") { lblMsg.Text = ""; lblErrMsg.Visible = true; lblErrMsg.Text = "Please Enter Customer Name."; PnlSearchResults.Visible = false; } else { lblMsg.Text = ""; lblErrMsg.Visible = false; fillSearchResults(); //Response.Write("domain=" + txtDomainName.Text + "cust=" + txtcustomerName.Text); } } } }//imgbtnSearch_Click thanx

                    N 1 Reply Last reply
                    0
                    • M miniThomas

                      Hi Guys, here is code: function checkDotOnly() { if (document.form1.txtcustomerName.length!=0) { if((document.form1.txtcustomerName.value==".")||(document.form1.txtcustomerName.value==". ")||(document.form1.txtcustomerName.value==" ")) { alert("Please Enter Valid Customer Name."); /*document.form1.lblErrMsg.value="Please Enter Valid Customer Name."; document.form1.lblErrMsg.disabled=false;*/ return false; } return true; } return true; } protected void imgbtnSearch_Click(object sender, ImageClickEventArgs e) { if (RadioButtonList1.SelectedValue.ToString() == "") { lblMsg.Text = ""; lblErrMsg.Visible = true; lblErrMsg.Text = "Please Select One Option."; PnlSearchResults.Visible = false; } else { if (RadioButtonList1.SelectedIndex.ToString() == "0" && ddlOrderNo.SelectedItem.Value == "-1") { lblMsg.Text = ""; lblErrMsg.Visible = true; lblErrMsg.Text = "Please Select Order Number."; PnlSearchResults.Visible = false; } else { lblErrMsg.Visible = false; fillSearchResults(); } if (RadioButtonList1.SelectedIndex.ToString() == "1") { if (txtcustomerName.Text == "") { lblMsg.Text = ""; lblErrMsg.Visible = true; lblErrMsg.Text = "Please Enter Customer Name."; PnlSearchResults.Visible = false; } else { lblMsg.Text = ""; lblErrMsg.Visible = false; fillSearchResults(); //Response.Write("domain=" + txtDomainName.Text + "cust=" + txtcustomerName.Text); } } } }//imgbtnSearch_Click thanx

                      N Offline
                      N Offline
                      N a v a n e e t h
                      wrote on last edited by
                      #10

                      Have you tried suggestion in my previous posting ?


                      My Website | Ask smart questions

                      1 Reply Last reply
                      0
                      • M miniThomas

                        Hi Vidya, The code is written On Click event thanx

                        M Offline
                        M Offline
                        manowj
                        wrote on last edited by
                        #11

                        Hi, Have you added this javascript function as the attributes of the button. EX: Button1.attributes.add("OnClick","") Try this out. Regards, Manowj

                        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