Your code are ASP code, or ASP.NET WebForms, maybe ASP.NET MVC?
At fiddle (https://fiddle.sencha.com/#fiddle/14bj) I see iFrame. Remember, if your button in iFrame, and your code with setting event handler in owner document, you should search button for setting your event inside of iFrame. It's will be not fount in parent document. Maybe problem is here. If you have PostBack (or another things, that reloads page), and button2 inside iFrame, then botton2 event handler will be lose after iFrame reloading. So, you will need set listener for event again, because it will be new button2 after reload (inside iFrame).
If you use ExtJS, then better set event on ExtJS button by component config. Somethin like this:
Ext.create('Ext.Button', {
text: 'Button2',
renderTo: Ext.getBody(),
handler: function() {
alert('You clicked the button 2!');
}});
Here example with two ways: https://fiddle.sencha.com/#fiddle/14hs
For better understood of your problem, culd you provide full code of this pages (if you couldn't use fiddle for asp, use http://pastebin.com/ or another service of posting sources).
I hope I wrote something helpfull (but not shure). Good luck!