Since our congress uses different colours every year, I would like to add an easy colour picker to the Global Settings page.
Unfortunately it doesn't work as desired.
What I did:
In the document type "Global Configuration Settings" I added a textfield called "sTCLogofarbe" to enter the HEX code of the colour.
And then the plan was to replace the colour code in the CSS by @stcfarbe1, but I don't get so far. The page produces a runtime error, and the log says:
System.Web.HttpCompileException (0x80004005): c:(...)\PageLogo.cshtml(9): error CS1061: 'Umbraco.Web.PublishedContentModels.ConfigGlobalSettings' does not contain a definition for 'sTCLogofarbe' and no extension method 'sTCLogofarbe' accepting a first argument of type 'Umbraco.Web.PublishedContentModels.ConfigGlobalSettings' could be found (are you missing a using directive or an assembly reference?)
By default this starter kit uses Models Builder in DLL mode. So in order to have strongly-typed properties on your front-end, you will need to regenerate models to include this new property, by going to Developer - Models Builder - Generate Models. Note that the first letter of your property will be capitalized in the strongly-typed model.
An alternative is to use the good old "magic string" approach, like:
I assume you have either inline CSS or a style element in your cshtml file - otherwise, if you're looking to use this variable on a .css file, it won't work.
Add colour picker to Global Settings
Hey guys,
Since our congress uses different colours every year, I would like to add an easy colour picker to the Global Settings page. Unfortunately it doesn't work as desired.
What I did:
In the PageLogo partial view I added the line
And then the plan was to replace the colour code in the CSS by @stcfarbe1, but I don't get so far. The page produces a runtime error, and the log says:
What can I do to make this work?
Thanks a lot! Simeon
By default this starter kit uses Models Builder in DLL mode. So in order to have strongly-typed properties on your front-end, you will need to regenerate models to include this new property, by going to Developer - Models Builder - Generate Models. Note that the first letter of your property will be capitalized in the strongly-typed model.
An alternative is to use the good old "magic string" approach, like:
Dear Sotiris,
Thanks! How do I implement this in the CSS? If I use
to call the value, this is being ignored. The same with
Sorry for my stupid questions...
Best, Simeon
I assume you have either inline CSS or a style element in your cshtml file - otherwise, if you're looking to use this variable on a .css file, it won't work.
I understand. Ok, then I have to think about it.
Thanks a lot!
Best, Simeon
is working on a reply...