+1-888-365-2779
Try Now
More in this section

Forums / Project Feather / SfPlaceholder in tag ?

SfPlaceholder in <head> tag ?

5 posts, 0 answered
  1. Tigger
    Tigger avatar
    17 posts
    Registered:
    25 Apr 2016
    23 Jun
    Link to this post
    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 ?

  2. Victor Leontyev
    Victor Leontyev avatar
    65 posts
    Registered:
    01 Jul 2014
    24 Jun in reply to Tigger
    Link to this post

    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

     

  3. Mariush
    Mariush avatar
    43 posts
    Registered:
    08 Aug 2014
    27 Jun
    Link to this post

    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.

  4. Tigger
    Tigger avatar
    17 posts
    Registered:
    25 Apr 2016
    29 Jun in reply to Victor Leontyev
    Link to this post
    Thanks Victor
  5. Tigger
    Tigger avatar
    17 posts
    Registered:
    25 Apr 2016
    29 Jun in reply to Mariush
    Link to this post
    Thanks for the help
5 posts, 0 answered