1

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

Lakshm
  • 67
  • 1
  • 8
  • Anyone please let me know how to use Web User Control in migration of asp.net core. I did some basic r&d but it showing viewcomponent and partial views. – Lakshm May 27 '21 at 08:43
  • Hi, please take a look to this question https://stackoverflow.com/questions/12714071/user-control-equivalent-in-asp-net-mvc-4. There is no possibility in Asp .Net Core create **UserControl** you should create PartialView. Read more in [official documentation](https://learn.microsoft.com/en-us/aspnet/core/mvc/views/partial?view=aspnetcore-5.0) – DarkSideMoon May 27 '21 at 09:11

1 Answers1

0

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.

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30