Posted on: 6/1/2005 8:32:17 PM | Views : 441

I was excited when I first heard that the Button class now has a property called UseSubmitBehavior because I understood that it would change the <input type='submit'> tag to <input type='button'>. This is a useful form of the button available in HTML because it does not post back. Instead, it lets you associate javascript code that fires in its onclick event. For example, if I have a checkboxlist with a Select All button that runs javascript to mark all checkboxes, I would use <input type='button'>. In ASP.NET 1.x, I had to use the HtmlControl for the button (<input type='button' runat=server>). In doing so, I lost some of the niceties of the Button control class, like easy style settings. In ASP.NET 2.0, the Button class also offers the OnClientClick property where I can supply that javascript I need in this button. Sounds perfect, right? Unfortunately, when UseSubmitBehavior is false, it always adds a javascript call to __doPostBack ...

Go to the complete details ...