I'm attempting to use the report viewer ASP.Net control in an ASP.Net MVC application. When I include the viewer control on a page I get the folwwoing error.
I'm using the simplest possible view to display the report viewer and which I copied from a Telerik sample that demonstrates how to use the report viewer in an ASP.Net MVC application (the sample does not run).
 
 
 
 
 
                                
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I'm using the simplest possible view to display the report viewer and which I copied from a Telerik sample that demonstrates how to use the report viewer in an ASP.Net MVC application (the sample does not run).
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %><%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.0.12.302, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">    Reports</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">    <h2>Test Report</h2>     <script runat="server">                 public override void VerifyRenderingInServerForm(Control control)        {            // to avoid the server form (<form runat="server">) requirement        }        protected override void OnLoad(EventArgs e)        {            base.OnLoad(e);                         // bind the report viewer            ReportViewer1.Report = new Mine.Web.UI.Reports.HelloWorld();        }    </script>    <telerik:ReportViewer runat="server" ID="ReportViewer1" /></asp:Content>
The error is being caused by the line below in my Site.Master file. Removing that line allows the report viewer to display but breaks the application because now the stylesheets needed for the Telerik ASP.NEt MVC controls aren't being loaded.
<%: Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.metro.css").Combined(true).Compress(true)) %>This seems like a really common scenario? Surely I'm not the first person to try and use the report viewer and the MVC extensions at the same time?