views:

1597

answers:

10

I have a gridview that is within an updatepanel for a modal popup I have on a page.
The issue is that the entire page refreshes every time I click an imagebutton that is within my gridview. This causes my entire page to load and since I have grayed out the rest of the page so that the user cannot click on it this is very annoying.

Does any one know what I am missing.

Edit: I entered a better solution at the bottom

+2  A: 

do you have ChildrenAsTriggers="false" on the UpdatePanel?

Are there any javascript errors on the page?

Ben Scheirman
A: 

Is the Modal Window popped up using the IE Modal window? Or is it a DIV that you are showing?

If it is an IE Modal Pop up you need to ensure you have

   <base target="_self" />

To make sure the post back are to the modal page.

If it is a DIV make sure you have your XHTML correct or it might not know what to update.

David Basarab
+2  A: 

Make sure you have the following set on the UpdatePanel: ChildrenAsTriggers=false and UpdateMode=Conditional

Compulsion
+1  A: 

Are you testing in Firefox or IE? We have a similar issue where the entire page refreshes in Firefox (but not IE). To get around it we use a hidden asp:button with the useSubmitBehavior="false" set.

<asp:Button ID="btnRefresh" runat="server" OnClick="btnRefresh_Click" Style="display: none" UseSubmitBehavior="false" />
Steven Williams
A: 

I would leave the onClick and set it as the trigger for the updatePanel.

That's odd that it works in FF and not IE. That is opposite from the behavior we experience.

Steven Williams
A: 

Is it possible to see the .aspx file?

David Basarab
A: 

UpdatePanels can be sensitive to malformed HTML. Do a View Source from your browser and run it through something like the W3C validator to look for anything weird (unclosed div or table being the usual suspects)

If you use Firefox, there's a HTML validator Extension/AddOn available that works quite nicely.

Compulsion
+2  A: 

I had this problem and came across the following article:

http://bloggingabout.net/blogs/rick/archive/2008/04/02/linkbutton-inside-updatepanel-results-in-full-postback-updatepanel-not-triggered.aspx

My button wasn't dynamically created in the code like in this example, but when I checked the code in the aspx sure enough it was missing an ID property. On adding the ID the postback became asynchronous and started to behave as expected.

So, in summary, check your button has an ID!

paulie
A: 

Several months later this problem was fixed. The project I was working in was a previous v1.1 which was converted with 2.0. However, in the web.config this line remained:

<xhtmlConformance mode="Legacy"/>

When it was commented out all of the bugs that we seemed to have with the ajax control toolkit disappeared

jmein
A: 

Thank you so much for posting this solution.