Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In .NET 8 / 9 ASP.NET Razor Class Library (RCL) views that use "partial" tag helper won't render nested views when referenced from ASP.NET Razor Pages app #55710

Open
1 task done
haykpetros opened this issue May 14, 2024 · 0 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Comments

@haykpetros
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I already reported this in #51364 but was asked to do so again as it was logged into a branch that is not being worked on anymore. Hopefully this time it will get attention and hopefully be addressed.

When referencing Razor Class Library (RCL) Partial View from ASP.NET Razor Pages app, nested views of RCL are not being rendered when using <partial name="..."> tag helper, but will render just fine when using await Html.PartialAsync(...)

Here is the screenshot that shows the behavior of the test solution that is attached to this issue:
image

In short, following code:

<h3>This is RCL's Primary Partial rendering nested partial using TagHelper</h3>

@await Html.PartialAsync("_NestedPartial")

and this one:

<h3>This is RCL Primary Partial rendering nested partial using TagHelper</h3>

<partial name="Shared/_NestedPartial.cshtml">

behave differently, when to the best of my understanding they should not. In fact, they behave same way when used directly in Razor Pages web application.

Expected Behavior

According to the documentation (https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/partial-tag-helper?view=aspnetcore-8.0) the Partial Tag Helper <partial> and the HTML Helper options for rendering a partial view @await Html.PartialAsync should behave the same.

Steps To Reproduce

Use following sample solution to see the behavior:
Razor Class Library Bug.zip

Exceptions (if any)

No response

.NET Version

9.0.100-preview.3.24204.13

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

No branches or pull requests

1 participant