Sunday, 16 August 2009

ASP.NET Buttons Not Firing

When adding a button to your website or application it is always best to add the button using the toolbox. The main reason for this that the GAC, as all .NET stuff lives and links in here. By using the toolbox Visual Studio will add all the necessary hidden code stuff to make the Visual Studio UI aware of your button. In fact this goes for any UI control.

Please do this an you will save yourself a ton of wasted time and unnecessary use of the FindControl code.

One other thing to remember is that ASP.NET is a validated language, and expects all elements to have some kind of processing. So remember that when you add your ASP.NET button to your page, you must include the following attributes for it to work. runat, id and CausesValidation.

So your new button would look like

Remember this simple rule and you should have no more button problems.



Web Development Chennai said...

Its highly informative. I would be visiting your blog hereafter regularly to gather valuable information.

web development company said...

Great post and very well written, that will really help you to learn Web Design, web development and SEO Strategies to help businesses web design company . You can find out many useful information about web design, seo and his work by visiting his blog and I Just wanna say thanks you for the information you have shared. Web Design Company India

website design chennai said...

thanks for sharing a nice post!!!!

logo design chennai said...

Newbrandmedia is unique because we organize online campaigns that transcend the web and enter the offline world so as to generate leads and sales for our clients. We value each client and ensure the best for each of them.