These two lines work perfectly. I was even able to track down the properties in the Primary Footer object, as seen here:
So I tried to add an additional property called "Fax" to the Primary Footer, like so:
I then tried to access this property in Footer.cshtml, but I am getting this error:
'PrimaryFooter' does not contain a definition for 'Fax' and no
accessible extension method 'Fax' accepting a first argument of type
'PrimaryFooter' could be found (are you missing a using directive or
an assembly reference?)
Why do "Address" and "Phone" work and my newly added "Fax" property doesn't? I really don't see how I could be missing a "using" or "include", since the "Address" and "Phone" properties are also part of the Primary Footer. What am I missing here?
It's a bit hard to know for sure, but I'm assuming you've made that change solely via the Umbraco back office?
Based on the error you are reporting, my guess would be that the Umbraco Models for the document types haven't regenerated, and as such, aren't available at run time.
Now the next bit all depends on how your site has been built and what "mode" Umbraco's Models Builder is in.
In theory, if your site is running in PureLive/InMemoryAuto mode, then the models would have automatically regenerated and you wouldn't be having this issue. So my guess is that the original developers of the site (if it wasn't you) have set them up to generate files to disk and then be compiled during build/runtime (depending on what version of Umbraco this is).
Could you confirm what version of Umbraco you are running? And if you have access to the original source code of your website and not just the deployed version?
Firstly, you are correct that we hired a contractor to deliver us the site, but thankfully we do have access to the source code. We are running 13.5.2 (just updated from 13.3).
You are also correct that I did make the change solely via the back office. However, I did take a look at the .Core.Models.Generated file for the "PrimaryFooter" object and can see the "Phone" and "Address" properties in the file, and do not see my newly created "Fax" property. I can see how one might simply define this property in that file, but I didn't try that as generated files can often be overwritten.
Thank you so much and I hope this helps you help me! :)
does not contain a definition for and no accessible extension method...
I have the following code in the Footer.cshtml of my site:
These two lines work perfectly. I was even able to track down the properties in the Primary Footer object, as seen here:
So I tried to add an additional property called "Fax" to the Primary Footer, like so:
I then tried to access this property in Footer.cshtml, but I am getting this error:
Here is the code as it is now:
Why do "Address" and "Phone" work and my newly added "Fax" property doesn't? I really don't see how I could be missing a "using" or "include", since the "Address" and "Phone" properties are also part of the Primary Footer. What am I missing here?
Hi Chris,
It's a bit hard to know for sure, but I'm assuming you've made that change solely via the Umbraco back office?
Based on the error you are reporting, my guess would be that the Umbraco Models for the document types haven't regenerated, and as such, aren't available at run time.
Now the next bit all depends on how your site has been built and what "mode" Umbraco's Models Builder is in.
In theory, if your site is running in PureLive/InMemoryAuto mode, then the models would have automatically regenerated and you wouldn't be having this issue. So my guess is that the original developers of the site (if it wasn't you) have set them up to generate files to disk and then be compiled during build/runtime (depending on what version of Umbraco this is).
Could you confirm what version of Umbraco you are running? And if you have access to the original source code of your website and not just the deployed version?
Thanks
Nik
Hi Nik! Thanks so much for the reply!
Firstly, you are correct that we hired a contractor to deliver us the site, but thankfully we do have access to the source code. We are running 13.5.2 (just updated from 13.3).
You are also correct that I did make the change solely via the back office. However, I did take a look at the .Core.Models.Generated file for the "PrimaryFooter" object and can see the "Phone" and "Address" properties in the file, and do not see my newly created "Fax" property. I can see how one might simply define this property in that file, but I didn't try that as generated files can often be overwritten.
Thank you so much and I hope this helps you help me! :)
is working on a reply...