Syntax Error: Rendering Block List Component
# help-with-umbraco
w
I am trying to render my block list component on the frontend but I'm keep getting the following error; The partial view 'BlockList/Components/richTextCenteredContent.cshtml' was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/RenderMvc/BlockList/Components/richTextCenteredContent.cshtml.aspx See more here: https://our.umbraco.com/forum/using-umbraco-and-getting-started/112232-syntax-error-rendering-block-list-component
s
Just to be sure: there is a view with that name in the partials/blocklist/components folder that inherits the umbracoviewpage<blocklistitem>
w
Yes, that file is here: https://prnt.sc/DYxl1rpBkGxg
Here is the error message:
r
have you tried taking out all the cshtml and just getting it to display a simple bit of html, to make sure the actual file is being hit
w
Yes, and it does hit that file as it renders the harcoded HTML. So it's something to do with the code that I have copied from the Umbraco docs and changed the bit where I needed to reference my block content alias.
r
so add things in step wise .. it m maybe a name of a prperty reference or something is null etc
w
I believe the problem is with this line of code;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>;
r
@inherits XXXXXX.Features.Blocks.BlockViewPage
this is just a pointer so you need to make sure that is correct and then you will have access to the model and you can doa simple @ if (model != null)
w
So do I need to change my inherit? I'm confused now.
These are my blocks https://prnt.sc/tSw4xZ_scCe2
So the @inherit do I need to rewrite to what?
r
oh okay.. i misinterpreted what you were asking .. ignore me....
you should be able to check use the modelbuilder to get those value.. ie @Model.Content.ContenHeading
s
I'd open the site in an IDE (Visual Studio, Rider) and attach a debugger. Best way to tell what is actually going on.
r
.. @Sebastiaan with the honest and best answer.. basically that will tell you what values it thinks are available..
s
A day of educated guessing hasn't helped so far, so time to pull out the proper tools! 🙂
r
i think you may be overstating the "educated"
w
Absolutely, I agree with you, I'm just sorting out access to clone the project from Umbraco Cloud and start working locally to debug the issue. I've checked the logs using Kudu and it keeps bringing back this error; Not exactly the best way of debugging the problem.
s
Often Razor errors are misleading and pointing to the wrong line(s) of code. That said, there's definitely a comma expected.. somewhere.. 😬 When you get access: https://docs.umbraco.com/umbraco-cloud/set-up/working-locally
r
or a missing semicolon
w
True, I will need to clone the site and check locally before I can progress any further.
* NOW RESOLVED ** thank you.
3 Views