Skip to main content
A newer version of this page is available. .

ExtensionsFactory.RenderStyleSheets(Page, StyleSheet[]) Method

Renders the specified style sheets in the response.

Namespace: DevExpress.Web.Mvc.UI

Assembly: DevExpress.Web.Mvc5.v18.2.dll

Declaration

public void RenderStyleSheets(
    Page page,
    params StyleSheet[] cssItems
)

Parameters

Name Type Description
page Page

The page object.

cssItems StyleSheet[]

An array of StyleSheet objects defining the attached style sheets.

Remarks

The RenderStyleSheets method is used to attach the necessary stylesheet files of the desired DevExpress theme. This method should be called within the HEAD tag of view pages (in most cases, it’s reasonable to call it within the Site.Master page).

See Applying Themes to learn more.

Example 1

The following code attaches DevExpress stylesheets, to provide the default appearance for DevExpress extensions.

View (or Master Page) Code:

<head runat="server">
...
<% Html.DevExpress().RenderStyleSheets(Page,
            new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout },
            new StyleSheet { ExtensionSuite = ExtensionSuite.Editors },
            new StyleSheet { ExtensionSuite = ExtensionSuite.HtmlEditor },
            new StyleSheet { ExtensionSuite = ExtensionSuite.GridView }
     ); %>
...
</head>

Example 2

This code registers stylesheets required to make the Aqua theme available within a web application.

View (or Master Page) Code:

<head runat="server">
    ...
    <% Html.DevExpress().RenderStyleSheets(Page, 
                new StyleSheet { ExtensionSuite = ExtensionSuite.GridView, Theme = "Aqua"},
                new StyleSheet { ExtensionSuite = ExtensionSuite.HtmlEditor, Theme = "Aqua"},
                new StyleSheet { ExtensionSuite = ExtensionSuite.Editors, Theme = "Aqua"},
                new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout, Theme = "Aqua"}
           ); %>
</head>

Example 3

The code below registers the stylesheets that are required to apply the Office2010Blue theme to NavBar and Menu extensions.

View (or Master Page) Code:

<head runat="server">
...
<% Html.DevExpress().RenderStyleSheets(Page,
            new StyleSheet { ExtensionType = ExtensionType.NavBar, Theme = "Office2010Blue" },
            new StyleSheet { ExtensionType = ExtensionType.Menu, Theme = "Office2010Blue" }
     ); %>
...
</head>

Note

The RenderStyleSheets method is analogous to the ExtensionsFactory.GetStyleSheets method that is designed for use in MVC Razor projects.

See Also