Monday, July 7, 2014

Use canned styles with DevExpress controls in an ASP.NET MVC application.

Here and here I was unable to style a DevExpress GridView. I have since figured out what I was missing however. In _Layout.cshtml one needs a .GetStyleSheets which mirrors the .GetScripts. What do I mean by that? Well, in my app, I expanded this:

@Html.DevExpress().GetScripts(
   new Script { ExtensionSuite = ExtensionSuite.NavigationAndLayout },
   new Script { ExtensionSuite = ExtensionSuite.HtmlEditor },
   new Script { ExtensionSuite = ExtensionSuite.GridView },
   new Script { ExtensionSuite = ExtensionSuite.Editors },
   new Script { ExtensionSuite = ExtensionSuite.Scheduler }
)

 
 

...to this:

@Html.DevExpress().GetScripts(
   new Script { ExtensionSuite = ExtensionSuite.NavigationAndLayout },
   new Script { ExtensionSuite = ExtensionSuite.HtmlEditor },
   new Script { ExtensionSuite = ExtensionSuite.GridView },
   new Script { ExtensionSuite = ExtensionSuite.Editors },
   new Script { ExtensionSuite = ExtensionSuite.Scheduler }
)
@Html.DevExpress().GetStyleSheets(
   new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout },
   new StyleSheet { ExtensionSuite = ExtensionSuite.HtmlEditor },
   new StyleSheet { ExtensionSuite = ExtensionSuite.GridView },
   new StyleSheet { ExtensionSuite = ExtensionSuite.Editors },
   new StyleSheet { ExtensionSuite = ExtensionSuite.Scheduler }
)

 
 

The result:

No comments:

Post a Comment