Wednesday, March 28, 2012

Programmatic Button Click not causing Async Postback in FireFox

I have posted this problem in a couple of different ways in the last few weeks but that was to ask what was the cause of the problem. Through trial and error I now know the cause but not the solution.

I have an UpdatePanel with a hidden asp button within it. The problem works the same whether the button is hidden or not. If I use javascript to fire the button's onclick event a regular post back happens. If I unhide the button and manually click it an async post back happens.

This is only the case with FF2. IE7 seems to work fine.

Anyone have an idea how I can work around this?

How are you hiding the button? if you're simply setting the style to have a visibility:hidden it should work the same, if you're setting it to visible=false then it's not actually being rendered to the page and the __doPostBack() javascript you are executing (assuming you are doing it that way) is just going to do a full post back. Do you have a trigger setup for the button or do you have the ChildrenAsTriggers property set in the UpdatePanel?

Any more details you can provide will help resolve this.

Cheers,
Al


Take a look at this post and my reponses to it. The key is to set on the hidden buttonUseSubmitBehavior="false" which in FF will prevent that submission postback you are seeing.

http://forums.asp.net/thread/1660684.aspx


Check the link

http://www.jeffzon.net/Blog/post/Refresh-the-UpdatePanel-using-JavaScript-code.aspx

No comments:

Post a Comment