Could not find UpdatePanel Error

Lanre Olaniyan asked on November 26, 2018 22:06

I have a page with 2 custom customtableform web parts. Only one displays at a time (create/ update) so I am using a macro to determine which web part zone should be visible. One of the fields in both forms uses the country state selector form control. When both web parts are visible, everything works correctly. If one is hidden, when I try to select a country/state the following error pops up:

Could not find UpdatePanel with ID 'XXX...'. If it is being updated dynamically then it must be inside another UpdatePanel.

I've figured out that in order for a web part's UpdatePanel to be generated, it (the web part) and it's zone needs to be visible, but it doesn't explain why an UpdatePanel is expected for a form that is not there. Also, is there another way to force the panel to be generated?

Recent Answers

Suneel Jhangiani answered on November 27, 2018 12:02

I'm not sure why you are getting the error, but one thing I do know is that the CountrySelector contains an update panel around the States dropdown and hence you may be getting the the error because of this.

A workaround would be to change the CountrySelector to simple drop down lists. You would need to specify the Has depending fields accordingly and you can set the visibility of the state control by checking the content of the Country field.

0 votesVote for this answer Mark as a Correct answer

Lanre Olaniyan answered on November 30, 2018 19:11

I figured out that if you use macros to handle a webpartzone's visibility, regardless of if it is visible or not, the form is still loaded on the page even if it doesn't show in the code. My solution was to add conditional layouts around the webpartzones and added the visibility logic there. I could be wrong, but I think that because the page layout loads before the zones fully load, adding the macro to the zones instead of the page layout causes them (and their web parts) to still be loaded and processed.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.