Vulnerability in EPiServer.Forms
Hi. I have a question. How would I go about adding custom css to the header? For example, I would like to create an XHTML property for Standard Page (page type) and then have the custom css display in the header after the meta tags and stylesheet link tags.
Is there a way to do this?
I had my code to display the property in the wrong file. It works now.
But for anyone wondering, this is how I did it.
1) Add a property to your page type. In my case, I named it "CustomCSS".
2) Set property as XHTML string, and under Properties for the Editor, uncheck all boxes so that only code will display.
3) In Header.ascx, add <%= CustomCSS %> where you want it to display.
4) In Header.ascx.cs, I added code to display the string:
protected string CustomCSS
if (CurrentPage.Property["CustomCSS"] != null)
Now you can go into your page and add your custom css into your property. I left it as xhtml string to give the option of either adding some simple css, then I can use <script type="text/css"></script>. But for more complex css, I can add css <link> tags to a custom stylesheet. It would also be easier to find the property if you added a custom tab, and placed the property in that tab.
If your just interested in creating a string that should not be editable by an html editor you can just use PropertyLongString instead of PropertyXhtmlString.
RegardsLinus EkströmEPiServer Development Team