Here's some background to help better understand the problem:

The company I work for makes x-ray scanners for security purposes. We have a page in our web app for viewing current scan activity. Currently, it's set to refresh every minute. I've been tasked with reworking the page so that it's event driven, refreshing every time a scan is saved. The information is displayed in a GridView, which is inside an update panel. The first column contains a thumbnail image of the scan, and an Ajax HoverMenuExtender for the purpose of enlarging the thumbnail when the cursor hovers over it.

When the page loads, everything works fine. I assume this is because all the extenders are created before the OnPreRender event is handled. Upon my scan event being fired, however, it fails when the GridView.DataBind() method is called. I assume this is because the OnPreRender event already occurred when the page first loaded and, as the exception says, extender controls may not be registered after prerender.

I've done a lot of digging on this exception, but have yet to find a solution that works. I read that moving the ToolkitScriptManager to the master page can fix it, but it's already on the master page. I also tried overloading the OnInit and OnPreRender handlers as follows:

protected override void OnInit(EventArgs e)
    if (this.DesignerMode)

protected override void OnPreRender(EventArgs e)

I tried putting that on the current activity page, the master page, and the base page, all to no avail.

I've come across slews of answers simply saying to register the controls before the prerender, which of course makes sense, but since new controls are being created dynamically upon event trigger after the initial page load, how can I accomplish that? Unfortunately, I just don't understand this well enough to know what else to try.

Related posts

Recent Viewed