Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Override for Razor Class Library does not work with current partial tag helpers

See original GitHub issue

We use the latest <partial name="" /> tag helper, but somehow it does not work when you override it in the actual MVC project, so the browser renders exactly the tag which means Razor does not recognise it as a valid partial wrapper.

One of the solutions could be to rollback to the old implementation of rendering partials, like @await Html.PartialAsync("_partial.cshtml")

Or we can completely get rid of the partials and start using components instead ( I like this option more, but needs to be tested if Razor engine on the top project can recognise it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

Zonnexcommented, Feb 25, 2019

So I have experimented more with this, and if we would convert to use Razor Pages instead of Controllers, we would make it possible to override our pages from many more folders.

Using a structure like this: image

We can then allow users to override our partials in these places whether or not the calling application is made with Razor Pages or Controllers.:


By staying with Controllers, I could only override the partials in 2 places, which I think it was these two

Zonnexcommented, Feb 26, 2019

Opened a new issue for further discussion regarding conversion. Here we simply update the documentation so it describes how to override partials.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class Library Tag Helper for Partial Pages not working in ...
In the ASP.NET Core 3.1 Razor Page, the custom Tag Helper code requires a 'using' reference to the Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers ...
Read more >
Tag Helpers in ASP.NET Core
Learn what Tag Helpers are and how to use them in ASP.NET Core.
Read more >
Partial Tag Helper in ASP.NET Core
The Partial Tag Helper is used for rendering a partial view in Razor Pages and MVC apps. Consider that it: Requires ASP.
Read more >
Working with Razor Class Libraries in ASP.NET Core
Overriding Class Library Content​​ The consuming application can override any aspect of the Razor Class Library by emulating the area folder ...
Read more >
The Anchor Tag Helper in Razor Pages
The anchor tag helper targets the HTML anchor ( <a> ) tag which is used to generate relative links from the values passed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found