Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Edited Issue: OnPreRender Problem with ModalPopupExtender [17122]

$
0
0
I have had a problem with the ModalPopupExtender that I couldn't work out. The error I was getting was very vague:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

But I found that a load of people were getting this especially with the UpdatePanel. I'm not sure how many are related to this problem but when I went digging around in the JavaScript error trace I found the real source of the error:

[InvalidOperationException: Extender controls may not be registered before PreRender.]
System.Web.UI.ScriptControlManager.RegisterExtenderControl(TExtenderControl extenderControl, Control targetControl) +369
System.Web.UI.ScriptManager.RegisterExtenderControl(TExtenderControl extenderControl, Control targetControl) +104
System.Web.UI.ExtenderControl.RegisterWithScriptManager() +177
System.Web.UI.ExtenderControl.OnPreRender(EventArgs e) +17
AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) +44
AjaxControlToolkit.ModalPopupExtender.OnPreRender(EventArgs e) +71
System.Web.UI.Control.PreRenderRecursiveInternal() +86
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041

So, I compiled the AjaxControlToolKit in debug and what do you know? It breaks on the OnPreRender event. I think it's because the ChangeVisibility method registers a script before the OnPreRender base method is called.

To give you some background about how this error comes up:

I have an ObjectDataSource which calls a WCF method. I have a FormView control which has a custom control which has a ModalPopupExtender and the FormView points to said ObjectDataSource. When I call DataBind() on the FormView, I get the error mentioned.

Christian

Viewing all articles
Browse latest Browse all 4356

Trending Articles