Including CSS in a Sitefinity User Control

By in
No comments

When working with Sitefinity Intra-Site Modules, all your module’s logic, code, and markup is contained in User Controls. This allows you to inherit all the styles from the default Sitefinity backend theme.

However you might want to add additional styling to your admin controls. You can accomplish this easily by adding a custom stylesheet for admin controls and referencing them from the user controls. Simply add the following code to each control’s frontend ascx file.

<%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
<sitefinity:ResourceLinks ID="ResourceLinks1" runat="server" UseEmbeddedThemes="false">
	<sitefinity:ResourceFile Name="~/Path/To/File.css" />
</sitefinity:ResourceLinks>

View Sample Code on Gist

The following two tabs change content below.

selaromdotnet

Senior Developer at iD Tech
Josh loves all things Microsoft and Windows, and develops solutions for Web, Desktop and Mobile using the .NET Framework, Azure, UWP and everything else in the Microsoft Stack. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom.