views:

2998

answers:

7

This is sort of a follow-up to my question here:

http://stackoverflow.com/questions/534045/asplabel-is-not-shown-when-visible-is-set-to-true

In the above question, I had a few controls were the visibility was not being set to false because they were not in an UpdatePanel. Once I put the controls inside an UpdatePanel, the toggling of visibility worked, but this has caused me another problem. I have an ImageButton that exports to excel. When the button was not in an update panel, the click event fired, but now that I put it inside and update panel, the click event does not fire.

I also have a dropdown which works fine. I am thinking it has something to do with the fact that the ImageButton does not have an AutoPostBack property.

Thanks, XaiSoft

A: 

No, ImageButtons don't have AutoPostBack: they don't need them any more than regular buttons do.

That behaviour sounds pretty weird. I'd say the first thing to try would be to change the asp:ImageButton into an asp:Button and see if that changes the behaviour. If not, the fact that it's an ImageButton is a red herring.

teedyay
A: 

I have exactly the same problem Xaisoft, did you work out what was the cause? I have a sneaking suspition it has something to do with validators, as firebug shows no network activity think another js call is preventing it

tigermain
A: 

Make sure that you have associated the Image Button to a PostBackTrigger on the UpdatePanel. If you are exporting to Excel using something similar to Matt Berseth's method, you have to have this trigger for the export to work.

<asp:PostBackTrigger ControlID="ImageButton1"/>
Matthew Jones
A: 

Try replacing the imagebutton with a menu (which contains a single menu-item) and set the imageurl property thereof.

BJLewies
A: 

myImagebutton.OnClientClick = "return true;";

Jose Freitas
A: 

change the 'CausesValidation' attribute to false.

Russell
A: 

I tried using but it still not worked here is my ASPX code. Did any one figured it how how to make it Excel download button inside update panel My Code Segment :

Akhil