How link the CSS file in the custom .master file

Posted by Community Admin on 04-Aug-2018 12:59

How link the CSS file in the custom .master file

All Replies

Posted by Community Admin on 03-Jan-2011 00:00
How link the CSS file in the custom .master file in Sitefinity 4.0 ?
i am using below path in my master file but it's not working
<link href="../App_Themes/theme/style.css" rel="stylesheet" type="text/css" media="all" />
css file folder
App_Data\Sitefinity\WebsiteTemplates\sample\App_Themes\theme\Global\style.css

Jitendra
Posted by Community Admin on 03-Jan-2011 00:00
Hello jitendra,

You can use CssEmbedControl

<%@ Register TagPrefix="sf" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.PublicControls"%>
 
<sf:CssEmbedControl runat="server" ID="CssEmbedControl1"  Url="Sitefinity/WebsiteTemplates/PageTemplates/App_Themes/Test/css/style.css" ></sf:JavaScriptEmbedControl>

All styles that you put inside Global folder should be automatically loaded on your page.

Best wishes,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 03-Jan-2011 00:00
after implementing this i am getting the error i have attached the screen grab
my custom master file code is here

<%@ Master="" Language="C#" AutoEventWireup="true" CodeFile="main.master.cs" Inherits="App_Master_StandardPage" %><br>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br>
  <%@Register  TagPrefix="sf" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.PublicControls"%><br>
    <html xmlns="http://www.w3.org/1999/xhtml"><br>
      <head id="Head1" runat="server"><br>
        <%--  <link href="../App_Themes/theme/style.css" rel="stylesheet" type="text/css" media="all" />--%><br>
        <sf:CssEmbedControl runat="server" ID="CssEmbedControl1"<br>
             Url="sitefinity/websitetemplates/sample/App_Themes/theme/style.css" ><br>
        </sf:CssEmbedControl ><br>
      </head><br>
      <body><br>
        <form id="form1" runat="server"><br>
          <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><br>
          <div id="header"><br>
            <asp:contentplaceholder id="head" runat="server"></asp:contentplaceholder><br>
          </div><br>
<br>
          <div id="banner"><br>
            <asp:contentplaceholder id="gallery" runat="server"></asp:contentplaceholder><br>
          </div><br>
          <div class="contentWrapper"><br>
            <asp:contentplaceholder id="content" runat="server"></asp:contentplaceholder><br>
          </div><br>
          <div id="Footer" class="footer"><br>
            <asp:contentplaceholder id="copyright" runat="server"></asp:contentplaceholder><br>
          </div><br>
        </form><br>
      </body><br>
    </html>

 
Posted by Community Admin on 03-Jan-2011 00:00
Hi jitendra deora,

You have a <br> tag inside of the declaration of the CssEmbedControl in your master page.

Best wishes,
Radoslav Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 04-Jan-2011 00:00
Hi
Just i have removed <br> tag but still i am getting the same error please check last thread attached screen grab
Please let me know

Please check my updated master file code below

<%@ master language="C#" autoeventwireup="true" codefile="main.master.cs" inherits="App_Master_main" %>
<%@Register  TagPrefix="sf" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.PublicControls"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/.../xhtml1-transitional.dtd">
<html xmlns="www.w3.org/.../xhtml">
<head id="Head1" runat="server">
</head>
<body>
    <form id="form1" runat="server">
    <asp:scriptmanager id="ScriptManager1" runat="server"></asp:scriptmanager>
    <sf:cssembedcontrol runat="server" id="CssEmbedControl1" url="Sitefinity/WebsiteTemplates/sample/App_Themes/theme/style.css"></sf:cssembedcontrol>
    <div id="header">
    </div>
    <div class="contentWrapper">
    </div>
    <div id="Footer" class="footer">
    </div>
    </form>
</body>
</html>
Posted by Community Admin on 04-Jan-2011 00:00
Hi jitendra,

Please take a look at the code below that shows how to register you custom stylesheet

<form id="form1" runat="server">
  <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
  <p> </p>
 
  <sf:CssEmbedControl MediaType="screen" runat="server" ID="CssEmbedControl1" Url="/empty/Sitefinity/WebsiteTemplates/PageTemplates/App_Themes/Test/css/styles.css" />
 </form>



Regards,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 04-Jan-2011 00:00
Thanks a lot it's working now .... :)
Jitendra
Posted by Community Admin on 19-Mar-2014 00:00

if my data structure started at App_Data, I would just put "App_Data" instead of "empty"? or is that some sort of pre-defined structure?

 

*Extremely new to Sitefinity

This thread is closed