Reusable UI Component

senthilkumar 1 Reputation point
2021-07-15T16:32:04.317+00:00

Hi,

How to build reusable UI Component( not class library) that can be used in multiple project ( different project & solution), in a project we could create Partial view can be reused, but how to use the same component in multiple web projects

What are the best option we have in .net framework 4.8

Regards,
ultimate

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,480 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 64,901 Reputation points
    2021-07-15T20:37:39.237+00:00

    While with web forms you could build user controls (in their own project) and share between projects), MVC 5 (4.8) does not have a good option. Typically you use project templates (which copies files) or you can create custom html helpers, but they will not have post back handling. Html helpers are pretty easy to create.

    In .net core, for MVC you use tag helpers or view components. For razor, you use razor components to create reusable UI components that can built into their own project.

    0 comments No comments

  2. Yijing Sun-MSFT 7,081 Reputation points
    2021-07-16T02:27:12.093+00:00

    Hi @senthilkumar ,
    What's type of your project? Webform? If your project is mvc,you could build custom MVC template this may match your requirement or you could use asp.net core.
    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.