3
Vote

Visual Editor Error-Error Creating Control

description

The Visual Editor had same error,When our page inherit MvpPage.(In VS2010)
The details:
Error Creating Control - ...
Vlaue cannot be null,Parameter name:httpContext

The demo has the same problem which in the source code.
My English don't very well,but i think u can understand.

file attachments

comments

duckaroy wrote Oct 21, 2010 at 7:09 AM

I can also confirm that I'm experiencing this issue. My setup is:

1) A master page inheriting from System.Web.UI.MasterPage
2) A content page that inherits from MvpPage<> that uses the master page.

The content page contains a number of controls that are showing up with errors and the master page doesn't load into the frame surrounding the content. Having said that, the page works fine during runtime.

davisimo wrote Feb 28, 2013 at 1:12 PM

The solution to the issue is:
  • Open WebFormsMvp\Web\MvpPage\MvpPage.cs
  • Go to the OnInit method
  • Change it to look like this:
        protected override void OnInit(EventArgs e)
        {
            registeredWithPageViewHost = true;

            __if (Context != null)__
                PageViewHost.Register(this, Context, AutoDataBind);
            
            base.OnInit(e);
        }
  • Rebuild
It takes 5 mins to find and fix. Not sure why this issue is open for 3 years.