Problem with Button Events
-
Hi Sometimes, I get the following problem: I create WebForms in VS.net. I drag & drop a button on the WebForm. Then I double click it to write the event code in the code-behind file. Then I test the button event on localhost and it works. Then I deploy the project on a Live shared server. I click on the same button, and nothing happens. If I include the onclick= "Button1_Click" to the html code , then the button event works on both: localserver & live server. So please tell me why I get this problem for some Button controls and how I get solve this problem ? (As I said I dont get this problem all the time)
-
Hi Sometimes, I get the following problem: I create WebForms in VS.net. I drag & drop a button on the WebForm. Then I double click it to write the event code in the code-behind file. Then I test the button event on localhost and it works. Then I deploy the project on a Live shared server. I click on the same button, and nothing happens. If I include the onclick= "Button1_Click" to the html code , then the button event works on both: localserver & live server. So please tell me why I get this problem for some Button controls and how I get solve this problem ? (As I said I dont get this problem all the time)
Hi there, Are sure that the code in the local dev box is the same as that in the live server? You might want to double check the web page with the button that does not work properly. From my experience, this phenomenon happens with the ASP.NET 1.x, are you using this version? So you may consider using your own code to wire up the event handlers in code-behind instead of using the generated code. Another option is to use the inline code to register the event handler like you have tried, and it's also used by default in the ASP.NET 2.0
-
Hi there, Are sure that the code in the local dev box is the same as that in the live server? You might want to double check the web page with the button that does not work properly. From my experience, this phenomenon happens with the ASP.NET 1.x, are you using this version? So you may consider using your own code to wire up the event handlers in code-behind instead of using the generated code. Another option is to use the inline code to register the event handler like you have tried, and it's also used by default in the ASP.NET 2.0
-
Hi, Is this a bug of ASP.NET 1.x? Because i too have faced the same problem sometime ago. But it got working once i removed the event handler code and again getting it by double clicking that. Best Regards, Apurva Kaushal
I'm not sure if it is actually a bug as I didn't see Microsoft claims about it or I just miss that. But they said, you might have the postback event problem, when you run your ASP.NET on multiple load-balanced servers and the .Net framework 1.1 SP1 has not been installed on all servers. Also when I found that VS 2003 sometimes deletes the auto-generated code containing the event handler registration, I managed to put it on my own.
-
I'm not sure if it is actually a bug as I didn't see Microsoft claims about it or I just miss that. But they said, you might have the postback event problem, when you run your ASP.NET on multiple load-balanced servers and the .Net framework 1.1 SP1 has not been installed on all servers. Also when I found that VS 2003 sometimes deletes the auto-generated code containing the event handler registration, I managed to put it on my own.