Question

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

Was it helpful?

Solution 5

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

OTHER TIPS

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

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

Are there any javascript errors on the page?

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!

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" />

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.

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.

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.

For reference..

I've also noticed, when using the dreaded <asp:UpdatePanel ... /> and <asp:LinkButton ... />, that as well as UpdateMode="Conditional" on the UpdatePanel the following other changes are required:

  • ViewStateMode="Enabled" is required on <asp:Content ... /> (I've set it to Disabled in the MasterPage)
  • ClientIDMode="Static" had to be removed from <%@ Page ... />

To prevent post-backs add return false to the onclick event.

button.attribute.add("onclick","return false;");

Sample:

string PopupURL = Common.GetAppPopupPath() + "Popups/StockChart.aspx?s=" + symbol;
hlLargeChart.Attributes.Add("onclick", String.Format("ShowPopupStdControls(PCStockChartWindow,'{0}');return false;", PopupURL));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top