Creating the BugTrackerLayout view

The BugTrackerLayout view is used as a template for the other views in the application. To create the layout view, you must perform the following:

  1. In the Areas/BugTracker/Views/Shared folder, create a new file with the cshtml extension.
    Name the class BugTrackerLayout.
  2. Add using statements to the following namespaces:
    • Telerik.Web.Mvc.UI
  3. Define the main HTML structure.
    Add the html, head, and body tags.
  4. Add the style sheets for the Telerik MVC extensions.
    The Telerik MVC extensions make use of predefined style sheets in order to style the controls created by them. In this example, you add a link to the telerik.common.css and the telerik.windows7.css files. Adding the style sheet references in this view will make them accessible in the other views. To add a link to a style sheet, you must perform the following:
    1. Call the Telerik method of the HtmlHelper object.
    2. Call the DefaultGroup method.
    3. Use the group argument to add links to the required style sheets.

    NOTE: For more information about how to acquire the predefined style sheets for the Telerik MVC extensions, read the Setting up the BugTracker Sitefinity application article.

  5. Define the HTML.
    Define the HTML for the layout view.
  6. Specify where the child views to be rendered.
    To specify where the other views to be rendered, call the RenderBody method of the view.

Here is a code example for the BugTrackerLayout view:

@using Telerik.Web.Mvc.UI
<!DOCTYPE html />
<html>
<head>
    @Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.windows7.css"))
</head>
<body>
    <h1>
        Bug tracker
    </h1>
    <div>
        @RenderBody()
    </div>
</body>
</html>

Next steps

+1-888-365-2779
sales@sitefinity.com

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK