UseSubmitBehavior=false
Most of the viewers would agree that there are so many gems hidden inside of asp.net that it takes some times years coming across them. Today I discovered SubmitBehavior property on button control. By default all button uses browser's default submit behavior to post the page back to the server. However there are cases when you are building server controls where you need explicit control as well as access to the JavaScript function that causes that button to post the page back to the server. In those scenarios, you can set the SubmitBehavior = false which will cause __doPostback JavaScript function to be attached to the button that will handle the postback for the button. On the server side, if you want to access the JavaScript function that causes the postback for the button you can use GetPostBackEventReference to access the JavaScript function. Here is a simple markup that uses UseSubmitBehavior property and also shows the JavaScript function emitted by asp.net.