SfPlaceholder in <head> tag ?

Posted by Community Admin on 05-Aug-2018 21:52

SfPlaceholder in tag ?

All Replies

Posted by Community Admin on 23-Jun-2016 00:00
I want a widget to able to select a style sheet from a Document & Files Library. But if if I use
 @Html.SfPlaceHolder("CSSPlaceHolder") with the <head> and </head> element of the template it does
not show while editing the page.

Are there any alternatives to getting something in the head element ?

Posted by Community Admin on 24-Jun-2016 00:00

You can easily add new styles in page head with this code inside your controller:

var page = this.GetHttpContext().CurrentHandler.GetPageHandler();
page.Header.Controls.Add(new LiteralControl(something));

If you still have problem, you can check source code of built-in stylesheet widget in sitefinity  https://github.com/Sitefinity/feather-widgets/blob/master/Telerik.Sitefinity.Frontend.InlineClientAssets/Mvc/Controllers/StyleSheetController.cs

 

Posted by Community Admin on 27-Jun-2016 00:00

The placeholders defined with @HTML.SfPlaceHolder are intended for dragging widgets from the UI. 

If you want to register assets at specific places you need sections and the @Html.Stylesheet helper method. Please refer to  the corresponding doc article for more details.

Posted by Community Admin on 29-Jun-2016 00:00
Thanks Victor
Posted by Community Admin on 29-Jun-2016 00:00
Thanks for the help
This thread is closed