Reputation: 1603
We are currently migrating an application from Web Forms to ASP MVC. Due to the size of it it's difficult doing it all in one go, so we are going to try to have an hybrid for a bit.
We are trying to reuse some of our user controls (.ascx
files) from Web Forms and we have had no problems when they are inheriting from System.Web.UI.UserControl
because System.Web.Mvc.ViewUserControl
inherits from it.
However, the problem seems to occur when they inherit from System.Web.UI.WebControls.CompositeControl
. Is there an equivalent of this class in MVC like Page
-> ViewPage
and UserControl
-> ViewUserControl
that can be used to solve the problem?
Upvotes: 1
Views: 161
Reputation: 1397
The answer is no, Because those controls inherits from WebControl
which depends on things like ViewState
and the Postback which are part of the classic WebForms model and no longer exist in ASP.NET MVC.
Also check the following answer https://stackoverflow.com/a/9039085/499930
Upvotes: 1