soundaranbu/Razor.Templating.Core

Not rendering partials inside a cshtml

nikhilramabhadra opened this issue · 1 comments

I have two queries:

  1. I have a cshtml file with 3 partials inside it. I followed your example but it does not have partials inside. The partials are not rendering. Model has been passed in.

     <div>
         <partial name="~/Folder/_Partial1" />
     </div>
    
     <div>
         <partial name="~/Folder/_Partial2" />
     </div>
    
     <div>
         <partial name="~/Folder/_Partial3" />
     </div>
    

No html is generated. What am I doing wrong?

  1. In your example (Render Razor View(.cshtml) to String in .NET Core) I did not see any specific folder structure required for the page, partial, and layout cshtml files (same as MVC)? Do we need to place files in specific folders in the Razor Class Library?

After using the folder structure:

Views
---AppSpecificFolder
------Example.cshtml
---Shared
------_Partial1
------_Partial2
------_Partial3
--_ViewImports.cshtml

Internal partials are also getting rendered.