YAFLogo

CodeJunky2008
14 years ago
ERROR

Sys.InvalidOperationException: Could not find Updatepanel with ID XXXX

PROBLEM

This bug is caused by switching off the show active discussions or show forum statistics in the host settings features menu. I ended up adding to the ForumStatitics.ascx and the ForumActiveDiscussion.asx UpdateMode=Conditional and this fixed the error.

SOLUTION

If the Update Panels omits the UpdateMode they default to UpdateMode=Auto then because the update panels are registered with the ScriptManager but they aren't on the page because of switching them off in the settings, when the page renders and looks for the UpdatePanel in the DOM and it won't be able to find it and you'll get the message.

The problem is caused because there are a number of UpdatePanels on my page and by default the UpdateMode property is not set in the ascx so it (defaults to Auto). What this means is that an event in one UpdatePanel will cause an update across all the other UpdatePanels set to Auto. By setting the update panel to UpdateMode=Conditional the panel is only affected when either the Update() method is called or when the event originates inside itself. It will only call itself and ignore the script manager and not call panels that have be explictly turned off.

Not sure if this is a great fix as I've only being work with the code for a week but it works. Maybe it woud be better to write some code in the Update() but just thought it might save people some debugging time.

Sponsor

Ederon
  • Ederon
  • 100% (Exalted)
  • YAF Developer
14 years ago
Thanks for posting
When I post FP:Ederon in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting.
Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
14 years ago
Thanks. Fixed and committed.