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 Button Not Working

ASP.NET Button Not Working

Scheduled Pinned Locked Moved Web Development
csharpasp-net
30 Posts 5 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.
  • P Offline
    P Offline
    Pradhip
    wrote on last edited by
    #1

    Hi folks: I have an asp.net button that's supposed to store some session variables and do a response.redirect.It worked like a doll until i went ahead and changed some code on the page load event that would fire before this event. Now the page load event works fine but the button just stopped working.I checked signature,recreated another button but of no use. Any reasons why it would not work. This is driving me mad. Why Need Parking lots in Bars when Drunken Driving is Prohibited

    P T T 3 Replies Last reply
    0
    • P Pradhip

      Hi folks: I have an asp.net button that's supposed to store some session variables and do a response.redirect.It worked like a doll until i went ahead and changed some code on the page load event that would fire before this event. Now the page load event works fine but the button just stopped working.I checked signature,recreated another button but of no use. Any reasons why it would not work. This is driving me mad. Why Need Parking lots in Bars when Drunken Driving is Prohibited

      P Offline
      P Offline
      Paul Riley
      wrote on last edited by
      #2

      What do you mean by "not working"? Is it not posting back, not firing the event or firing it but not doing what it's supposed to do? I think you're saying that it's posting back but not firing the event. If that's the case, check the events list for the button: Highlight the button, click the little lightning button above the properties window. If there's no method listed by the event, use the drop down button to select the right method. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

      P 2 Replies Last reply
      0
      • P Paul Riley

        What do you mean by "not working"? Is it not posting back, not firing the event or firing it but not doing what it's supposed to do? I think you're saying that it's posting back but not firing the event. If that's the case, check the events list for the button: Highlight the button, click the little lightning button above the properties window. If there's no method listed by the event, use the drop down button to select the right method. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

        P Offline
        P Offline
        Pradhip
        wrote on last edited by
        #3

        Hi Paul: Well what i mean by not working is that the button click event is not firing. I do not know if its being posted back or not.But there is absolutely no activity on the window. And yeah i tried what you told me to do.I go to the button in designer view.Right click on it.Click Properties.Then what??i dont see ay lighting window.nor are any events assoicated with this button mentioned anywhere in its properties lisetd Thank you Why Need Parking lots in Bars when Drunken Driving is Prohibited

        P 2 Replies Last reply
        0
        • P Pradhip

          Hi Paul: Well what i mean by not working is that the button click event is not firing. I do not know if its being posted back or not.But there is absolutely no activity on the window. And yeah i tried what you told me to do.I go to the button in designer view.Right click on it.Click Properties.Then what??i dont see ay lighting window.nor are any events assoicated with this button mentioned anywhere in its properties lisetd Thank you Why Need Parking lots in Bars when Drunken Driving is Prohibited

          P Offline
          P Offline
          Paul Riley
          wrote on last edited by
          #4

          Sorry, are you using VB.NET? I'm thinking in C# terms because I've been using it for weeks. In VB.NET you need to check the "Handles" clause on the method declaration: eg

          Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
          

          If it doesn't handle the correct event for the correct control name then that's your problem. You can tell if it's posting back by putting a breakpoint into Page_Load, if it's posting back then it will run this, if it's not then you won't break. If it's not posting back, you need to check the AutoPostBack property of the button. If it's false then that's your problem. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

          1 Reply Last reply
          0
          • P Pradhip

            Hi Paul: Well what i mean by not working is that the button click event is not firing. I do not know if its being posted back or not.But there is absolutely no activity on the window. And yeah i tried what you told me to do.I go to the button in designer view.Right click on it.Click Properties.Then what??i dont see ay lighting window.nor are any events assoicated with this button mentioned anywhere in its properties lisetd Thank you Why Need Parking lots in Bars when Drunken Driving is Prohibited

            P Offline
            P Offline
            Paul Riley
            wrote on last edited by
            #5

            WAIT! There is no AutoPostBack on a button, it's always on. If you're not posting back then there's something wrong with your HTML. Can you post that bit of it? Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

            1 Reply Last reply
            0
            • P Paul Riley

              What do you mean by "not working"? Is it not posting back, not firing the event or firing it but not doing what it's supposed to do? I think you're saying that it's posting back but not firing the event. If that's the case, check the events list for the button: Highlight the button, click the little lightning button above the properties window. If there's no method listed by the event, use the drop down button to select the right method. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

              P Offline
              P Offline
              Pradhip
              wrote on last edited by
              #6

              Okay I created one more button with a very simple code.Just a response.write code.And that event did not fire too when the button was clicked.So i can :(( say that the postback is not occuring on the page.:( Why Need Parking lots in Bars when Drunken Driving is Prohibited

              P 1 Reply Last reply
              0
              • P Pradhip

                Okay I created one more button with a very simple code.Just a response.write code.And that event did not fire too when the button was clicked.So i can :(( say that the postback is not occuring on the page.:( Why Need Parking lots in Bars when Drunken Driving is Prohibited

                P Offline
                P Offline
                Paul Riley
                wrote on last edited by
                #7

                Can you post as much of your code (HTML and VB.NET) as possible? Or I'll let you get away with email for that one, if you're not comfortable posting it to the forum. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                P 1 Reply Last reply
                0
                • P Paul Riley

                  Can you post as much of your code (HTML and VB.NET) as possible? Or I'll let you get away with email for that one, if you're not comfortable posting it to the forum. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                  P Offline
                  P Offline
                  Pradhip
                  wrote on last edited by
                  #8

                  Paul: Thank you.I have sent an email to you. Why Need Parking lots in Bars when Drunken Driving is Prohibited

                  P 1 Reply Last reply
                  0
                  • P Pradhip

                    Paul: Thank you.I have sent an email to you. Why Need Parking lots in Bars when Drunken Driving is Prohibited

                    P Offline
                    P Offline
                    Paul Riley
                    wrote on last edited by
                    #9

                    I don't get it! It works fine for me. I had to remove much of the code because I don't have the DataAccessService object but all the events seem to be firing in the correct order in response to the right clicks. I'm sorry, mate, I just can't see a problem with the code. Have you been fiddling with the project or solution at all? Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                    1 Reply Last reply
                    0
                    • P Pradhip

                      Hi folks: I have an asp.net button that's supposed to store some session variables and do a response.redirect.It worked like a doll until i went ahead and changed some code on the page load event that would fire before this event. Now the page load event works fine but the button just stopped working.I checked signature,recreated another button but of no use. Any reasons why it would not work. This is driving me mad. Why Need Parking lots in Bars when Drunken Driving is Prohibited

                      T Offline
                      T Offline
                      taks
                      wrote on last edited by
                      #10

                      hi, I got the same problem too. When i filled some drop down lists in the page load event, the events stopped firing. Also when i put a put a break point, the page load is running more than once. once i took out the code to fill a certain drop down list, the button events fired ok. I know, if you put a response.redirect in a try/catch block, you will have a problem. the asp.net will through a thread aborted exception. but could not figure out my problem.

                      P 1 Reply Last reply
                      0
                      • T taks

                        hi, I got the same problem too. When i filled some drop down lists in the page load event, the events stopped firing. Also when i put a put a break point, the page load is running more than once. once i took out the code to fill a certain drop down list, the button events fired ok. I know, if you put a response.redirect in a try/catch block, you will have a problem. the asp.net will through a thread aborted exception. but could not figure out my problem.

                        P Offline
                        P Offline
                        Pradhip
                        wrote on last edited by
                        #11

                        Hi Taks: I did exactly what u said u did when it stopped working."Populate some drop down list boxes". And it was working fine before i inserted that piece of code to do this.So now i am kind of confused.Without the population there is no real meaning to the form.It just will not solve the purpose. Would you suggest I use an ImageButton or something like that.Or Just a hyperlink to another page that processes the code. Why Need Parking lots in Bars when Drunken Driving is Prohibited

                        P 1 Reply Last reply
                        0
                        • P Pradhip

                          Hi Taks: I did exactly what u said u did when it stopped working."Populate some drop down list boxes". And it was working fine before i inserted that piece of code to do this.So now i am kind of confused.Without the population there is no real meaning to the form.It just will not solve the purpose. Would you suggest I use an ImageButton or something like that.Or Just a hyperlink to another page that processes the code. Why Need Parking lots in Bars when Drunken Driving is Prohibited

                          P Offline
                          P Offline
                          Paul Riley
                          wrote on last edited by
                          #12

                          Pradhip wrote: I did exactly what u said u did when it stopped working."Populate some drop down list boxes". Interesting! Try this: Instead of creating the DataSets IN the code, try dropping them off the toolbox onto your page in design mode. When the dialog pops up asking what type of dataset you want, select Untyped DataSet. Then you can set the DataSource properties for the DropDownLists in the properties window in design mode. This is a really long shot but the fact that two of you have had the same problem leads me to wonder about .NET bugs. And the fact is that your event handling is fine so it has to be something more obscure. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                          T P 2 Replies Last reply
                          0
                          • P Paul Riley

                            Pradhip wrote: I did exactly what u said u did when it stopped working."Populate some drop down list boxes". Interesting! Try this: Instead of creating the DataSets IN the code, try dropping them off the toolbox onto your page in design mode. When the dialog pops up asking what type of dataset you want, select Untyped DataSet. Then you can set the DataSource properties for the DropDownLists in the properties window in design mode. This is a really long shot but the fact that two of you have had the same problem leads me to wonder about .NET bugs. And the fact is that your event handling is fine so it has to be something more obscure. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                            T Offline
                            T Offline
                            taks
                            wrote on last edited by
                            #13

                            Actually, I had couple of problems. First thing was, the issue with drop down lists. I had some 5 drop down lists. If i fill a particular drop down list out of 5 the events stopped working. When I commented out the code to fill that one particular drop down. the events worked. that's strange. And another problem i had was with calender controls. My events wont fire if i have some 4 buttons along with 2 calender controls. I replaced 2 buttons with hyperlinks and events started firing, but then I had some validation controls too on the page and if the Page was invalid, then next time a SelectionChanged Event on calender is fired, it opens a new window and throws a java script error. So The Asp.Net Events are killing me. I will follow your suggestion paul for the drop down lists.

                            P 2 Replies Last reply
                            0
                            • P Paul Riley

                              Pradhip wrote: I did exactly what u said u did when it stopped working."Populate some drop down list boxes". Interesting! Try this: Instead of creating the DataSets IN the code, try dropping them off the toolbox onto your page in design mode. When the dialog pops up asking what type of dataset you want, select Untyped DataSet. Then you can set the DataSource properties for the DropDownLists in the properties window in design mode. This is a really long shot but the fact that two of you have had the same problem leads me to wonder about .NET bugs. And the fact is that your event handling is fine so it has to be something more obscure. Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                              P Offline
                              P Offline
                              Pradhip
                              wrote on last edited by
                              #14

                              Hi Paul: I tried it the way u said.But still its the same.I created all the datasets on the design time.did the matching of the datasets to the corresponding control in the design page by setting the datasource property. And all that i really did in the code was get the data from the Dbase and populating the listboxes with them.But still would not work. Now i shall try commenting out the population one by one and see what happens Taks and Paul thanks anyows for the help.U folks are great Pradhip Why Need Parking lots in Bars when Drunken Driving is Prohibited

                              P 1 Reply Last reply
                              0
                              • T taks

                                Actually, I had couple of problems. First thing was, the issue with drop down lists. I had some 5 drop down lists. If i fill a particular drop down list out of 5 the events stopped working. When I commented out the code to fill that one particular drop down. the events worked. that's strange. And another problem i had was with calender controls. My events wont fire if i have some 4 buttons along with 2 calender controls. I replaced 2 buttons with hyperlinks and events started firing, but then I had some validation controls too on the page and if the Page was invalid, then next time a SelectionChanged Event on calender is fired, it opens a new window and throws a java script error. So The Asp.Net Events are killing me. I will follow your suggestion paul for the drop down lists.

                                P Offline
                                P Offline
                                Pradhip
                                wrote on last edited by
                                #15

                                Okay so here is the status: The code works if i comment out all the five databindings that i do on that page.I knew the page was working fine with 2 databinds before i added three more. So first i brought it to the same 2 databinds.And it did not work. Now when i comment out all the 5 it works. How more wild can a challenge get.. Why Need Parking lots in Bars when Drunken Driving is Prohibited

                                1 Reply Last reply
                                0
                                • P Pradhip

                                  Hi Paul: I tried it the way u said.But still its the same.I created all the datasets on the design time.did the matching of the datasets to the corresponding control in the design page by setting the datasource property. And all that i really did in the code was get the data from the Dbase and populating the listboxes with them.But still would not work. Now i shall try commenting out the population one by one and see what happens Taks and Paul thanks anyows for the help.U folks are great Pradhip Why Need Parking lots in Bars when Drunken Driving is Prohibited

                                  P Offline
                                  P Offline
                                  Paul Riley
                                  wrote on last edited by
                                  #16

                                  Pradhip wrote: Taks and Paul thanks anyows for the help.U folks are great Don't thank us til we get a result. In fact I should thank you... I didn't know those FindBy functions existed for DropDownLists until I read your code; that'll be really useful for me. :) So tell me... what is that DataAccessService? Is that something of yours or something I can download? Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                                  P 1 Reply Last reply
                                  0
                                  • T taks

                                    Actually, I had couple of problems. First thing was, the issue with drop down lists. I had some 5 drop down lists. If i fill a particular drop down list out of 5 the events stopped working. When I commented out the code to fill that one particular drop down. the events worked. that's strange. And another problem i had was with calender controls. My events wont fire if i have some 4 buttons along with 2 calender controls. I replaced 2 buttons with hyperlinks and events started firing, but then I had some validation controls too on the page and if the Page was invalid, then next time a SelectionChanged Event on calender is fired, it opens a new window and throws a java script error. So The Asp.Net Events are killing me. I will follow your suggestion paul for the drop down lists.

                                    P Offline
                                    P Offline
                                    Pradhip
                                    wrote on last edited by
                                    #17

                                    Okay after laboring for over 3 hrs i just give up.The maximum number of databinds i can do on a page is 4.if its 4 it works fine.Otherwise it goofs up.I tried it in many different ways.And then again which 4 kind of depends.i had some data mismatches with my database and i had to look at that too. But this is one weird problem.So i now have a form that does not allow changing of data for 2 columns in one page but it does in other.Boy my users are going to think im 'a nut.. Thank you Paul and Taks.. Pradhip Why Need Parking lots in Bars when Drunken Driving is Prohibited

                                    P 1 Reply Last reply
                                    0
                                    • P Paul Riley

                                      Pradhip wrote: Taks and Paul thanks anyows for the help.U folks are great Don't thank us til we get a result. In fact I should thank you... I didn't know those FindBy functions existed for DropDownLists until I read your code; that'll be really useful for me. :) So tell me... what is that DataAccessService? Is that something of yours or something I can download? Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                                      P Offline
                                      P Offline
                                      Pradhip
                                      wrote on last edited by
                                      #18

                                      Oh that's just a COM object we got to do our dataaccess. Why Need Parking lots in Bars when Drunken Driving is Prohibited

                                      1 Reply Last reply
                                      0
                                      • P Pradhip

                                        Okay after laboring for over 3 hrs i just give up.The maximum number of databinds i can do on a page is 4.if its 4 it works fine.Otherwise it goofs up.I tried it in many different ways.And then again which 4 kind of depends.i had some data mismatches with my database and i had to look at that too. But this is one weird problem.So i now have a form that does not allow changing of data for 2 columns in one page but it does in other.Boy my users are going to think im 'a nut.. Thank you Paul and Taks.. Pradhip Why Need Parking lots in Bars when Drunken Driving is Prohibited

                                        P Offline
                                        P Offline
                                        Paul Riley
                                        wrote on last edited by
                                        #19

                                        I refuse to let you give up :-D So what's the pattern? Is there one that always doesn't work or a combination of two that screw things up? Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                                        P L 2 Replies Last reply
                                        0
                                        • P Paul Riley

                                          I refuse to let you give up :-D So what's the pattern? Is there one that always doesn't work or a combination of two that screw things up? Paul Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02 I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02

                                          P Offline
                                          P Offline
                                          Pradhip
                                          wrote on last edited by
                                          #20

                                          Okay the pattern. Well first i had 5. what i did was remove all.The page worked. Then i went ahead and added 4 of them except the one that was causing me trouble and had some possible data mismatches on the DB( This is combineSN). THEN it started bombing out.So i removed it.Now we are back to 4 working and the page loads and the next page button also works. Okay then i removed one more thats working just fine(REPAIRTYPE) and instead added this troublesome one the one with the data problems.Then now after that it loaded fine.But the next page button would not fire. Then what i did was remove the trouble some one(COMBINEsn).Add the old guy(Repairtype) and add one more(Failuretype)..so that makes it 5 and the page did not work.Then i removed failure type and it worked. So then i goto the next page and add combineSN AND FAILURETYPE AND THEY ALSO WORK FINE IN THE NEXT PAGE.so i have failure type and combinesn grayed out in page one but can be edited in page 2. So thats that for now. Pradhip.S Why Need Parking lots in Bars when Drunken Driving is Prohibited

                                          P 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