How to use System.Web.UI.UserControl in .net core

5.5k Views Asked by At

I'm migrating MVC application to ASP.NET CORE. In that I'm using web user control.

UserControl ctrl= oLogSite as UserControl; Here oLogSite is object type.

Please let me know how to use in .Core

1

There are 1 best solutions below

0
On

From this article, we can see that the UserControl used in the traditional Asp.net Web Form application and it applies for .NET Framework, instead of .Net Core. So, .Net Core doesn't support UserControl.

To achieve the similar behavior in .Net Core application, as you said, You could ViewComponent or Partial View. Besides, you could also consider creating custom tag helper to render multiple html elements.