Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharing ASP.NET MVC partial views between projects

Tags:

People also ask

Should you split your ASP NET MVC project into multiple projects?

It shouldn't! That's why it's designed in a modular way. In most web applications out there, we version and deploy all these assemblies (Web, BLL and DAL) together. So, separating a project into 3 projects does not add any values.

Can you define partial view in MVC?

A partial view is a Razor markup file ( . cshtml ) without an @page directive that renders HTML output within another markup file's rendered output. The term partial view is used when developing either an MVC app, where markup files are called views, or a Razor Pages app, where markup files are called pages.

Can we use multiple partial view in MVC?

The data will be fetched from database using Entity Framework and then multiple Partial Views will be rendered inside For Loop using the @Html. Action function in ASP.Net MVC Razor. In this article I will explain with an example, how to render multiple Partial Views inside Loop using Model in ASP.Net MVC Razor.


What is the best way to share a common Partial View between applications? I've created a separate assembly containing my Partial View in an ascx file, some scripts that go with that view and an HtmlHelper extension method to make creating the partial view easier. However, when referencing that assembly from an ASP.NET MVC application, it can't find the partial view as the ascx file is not copied as well. Also, what is the best way of including the attached scripts with the application? The only way I can see at the moment is to copy the relevant files to the new application.