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
Comments: Same problem I am also facing. Today only i have downloaded AJAX Control toolkit and I wanted to implement ModalPopupExtender. but here is the vague error I am facing.... *************************************************************************** [InvalidOperationException: The TargetControlID of 'mpe' is not valid. A control with ID 'btnIssue' could not be found.] System.Web.UI.ExtenderControl.RegisterWithScriptManager() +327123 System.Web.UI.ExtenderControl.OnPreRender(EventArgs e) +19 AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) in C:\Users\Stephen\Documents\Repos\Superexpert\AjaxControlToolkit\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:365 AjaxControlToolkit.ModalPopupExtender.OnPreRender(EventArgs e) in C:\Users\Stephen\Documents\Repos\Superexpert\AjaxControlToolkit\Server\AjaxControlToolkit\ModalPopup\ModalPopupExtender.cs:245 System.Web.UI.Control.PreRenderRecursiveInternal() +80 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 ***************************************************************************** Why is it going to C:\Users\Stephen\.... path for searching ModalPopupExtender.cs file. This path is not even existing in my machine. If anyone has the solution please share it.
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
Comments: Same problem I am also facing. Today only i have downloaded AJAX Control toolkit and I wanted to implement ModalPopupExtender. but here is the vague error I am facing.... *************************************************************************** [InvalidOperationException: The TargetControlID of 'mpe' is not valid. A control with ID 'btnIssue' could not be found.] System.Web.UI.ExtenderControl.RegisterWithScriptManager() +327123 System.Web.UI.ExtenderControl.OnPreRender(EventArgs e) +19 AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) in C:\Users\Stephen\Documents\Repos\Superexpert\AjaxControlToolkit\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:365 AjaxControlToolkit.ModalPopupExtender.OnPreRender(EventArgs e) in C:\Users\Stephen\Documents\Repos\Superexpert\AjaxControlToolkit\Server\AjaxControlToolkit\ModalPopup\ModalPopupExtender.cs:245 System.Web.UI.Control.PreRenderRecursiveInternal() +80 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 ***************************************************************************** Why is it going to C:\Users\Stephen\.... path for searching ModalPopupExtender.cs file. This path is not even existing in my machine. If anyone has the solution please share it.