This project is read-only.

dynamically load MvpControl

Jan 31, 2012 at 8:41 AM

I am trying use webforms.mvp with sharepoint to write mvp webparts.

The control works fine on basic aspx page, but for web part it needs to load dynamically with LoadControl("~/Controls/Control1.ascx")

It throws InvalidOperationException :

The Model property is currently null, however it should have been automatically initialized by the presenter. This most likely indicates that no presenter was bound to the control.

It is possibble to load mvp control dynamically?

 

May 25, 2012 at 7:14 AM

No idea if this is still relevant, but I ran into the same issue yesterday. After looking at the WebFormsMVP code and trace information, I noticed the issue was caused because I performed the LoadControl() command AFTER Page_Init was finished.

Moving the LoadControl() to Page_Init solved the problem.