Lakshm
Lakshm

Reputation: 67

Using User controls in .Net Core

I'm migrating the MVC application into .Net Core. So I have some user controls in the MVC application so I have to use those in the .net core application. Can anyone please help me how to achieve this.

Upvotes: 1

Views: 2758

Answers (1)

Jerry Cai
Jerry Cai

Reputation: 949

Asp.net core does not support user controls.

As a substitute, you can use ViewComponent , partial view or Custom TagHelper to do it's job.

They can be reusable, just like user control.

So you should understand the logic in User Controls, and then apply the logic in these ways:

ViewComponent tutorial

Partial View tutorial

Custom TagHelper

I suggest you trying ViewComponent first, because it is more suitable when you want to

write some complex logic, and it always renders chunk rather than a whole process.

Upvotes: 1

Related Questions