New to Telerik Reporting? Download free 30-day trial

How to create HTML5 MVC Report Viewer inside master page layout


Product Progress® Telerik® Reporting
Project Type MVC
Viewer HTML5 Viewer


When using HTML5 ASP.NET MVC Report Viewer to display reports in MVC application, by default its not specified any Layout, so it is set to null.

In general, setting Layout explicitly to null might be necessary if you want to get rid of a standard layout defined in _Layout.cshtml. When you make @{Layout=null} you are explicitly saying that this is your final layout so it is not nested in any master layout.


When initialize a new HTML5 MVC Report Viewer template in web application, it comes with the directive Layout = null in order to remove the default layout inheritance in that view. This allows including the whole HTML structure of Web page using markup, i.e. styles, scripts, meta information, custom body layout etc.

So, to create a MVC web application which contains the report viewer page inside the master layout, the report viewer template (for example ReportViewer.cshtml) must have only the body part. All meta information, styles and scripts, which are referred between the opening and closing head tags, have to be moved in the master Layout file in order to run correctly.

ReportViewer.cshtml file should contain only the body part, for example:

@using DemoWebMVCApplication
@using Telerik.Reporting
@using Telerik.ReportViewer.Mvc
 Layout = "~/Views/Shared/_Layout.cshtml";

        .ReportSource(new UriReportSource() { Uri = "SampleReport.trdp" })

And the _Layout.cshtml file should contain all links and scripts:

<!DOCTYPE html>
    <meta charset="utf-8" />
    <title>@ViewBag.Title - My ASP.NET Application</title>

    @* Links and scripts from the report viewer *@
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <script src=""></script>
    <link href="" rel="stylesheet" />
    <link href="" rel="stylesheet" />
        #reportViewer1 {
            position: relative;
            width: 1300px;
            height: 900px;
            font-family: Verdana, Arial;
    @* End of the head resources*@

    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    <li>@Html.ActionLink("About", "About", "Home")</li>
                    <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                    <li>@Html.ActionLink("Report", "Report", "Home")</li>
    <div class="container body-content">
        <hr />
            <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>

    @RenderSection("scripts", required: false)

    @* Scripts from the report view. Note that in order to be fired, they need to be at the end of the body *@
    <script src="@Url.Content("~/ReportViewer/js/telerikReportViewer.kendo-")"></script>
    <script src="@Url.Content("~/ReportViewer/js/telerikReportViewer-")"></script>
    @*End of the scripts*@

In this article