ReportViewer in a custom module - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

ReportViewer in a custom module

  • ReportViewer in a custom module
  • 256582_ReportViewerError.png

    I have a SF4.0 custom module based off the JobsModule. For the overview page (JobApplicationsOverview.ascx file) where the JobsModule has a radgrid. I want to put a ReportViewer on that page, but when I add one to my equivalent ascx file I get this error (also attached).

    "The ReportViewer control failed to setup the http handler in the web.config file. You may experience troubles when viewing the report. Exception details: Object reference not set to an instance of an object."

    It seems to be pointing me to modify my web.config file manually, but I'm not sure what change to make.


  • Hopefully to make this simpler to reproduce, I started with the JobsModule demo and changed the JobApplicationsOverview.ascx to this (note: attempting to add ReportViewer to this page with a corresponding Register tag):

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
        Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>

    <h1 class="sfBreadCrumb" id="sfToMainContent">Job applications</h1>
    <div class="sfMain sfClearfix">
        <telerik:RadGrid ID="RadGrid1" Width="100%" AllowSorting="True" PageSize="15" AllowPaging="True" AllowMultiRowSelection="True" runat="server" Gridlines="None">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView AutoGenerateColumns="False" Summary="RadGrid table">
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="1First Name" />
                    <telerik:GridBoundColumn  DataField="LastName" HeaderText="Last Name" />
                    <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone Number" />
                    <telerik:GridDateTimeColumn DataField="DateCreated" HeaderText="Submission Date" />
                    <telerik:GridBoundColumn DataField="HowDidYouHear" HeaderText="Referrer" />
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn">
                        <HeaderStyle Width="30px" />
                            <asp:HyperLink runat="server" ID="DocumentLink" NavigateUrl='<%# Eval("MediaUrl") %>' Text='Download'/>
        <telerik:ReportViewer ID="ReportViewer1" runat="server" Visible="false" Width="100%" Height="100%">

    This is the error I get when trying to view this page in the SF administrator:

    Server Error in '/' Application.

    Could not resolve type for tag "telerik:ReportViewer". Make sure the proper namespace is registered.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.ArgumentException: Could not resolve type for tag "telerik:ReportViewer". Make sure the proper namespace is registered.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace: 

    [ArgumentException: Could not resolve type for tag "telerik:ReportViewer". Make sure the proper namespace is registered.]
       Telerik.Sitefinity.Web.UI.Templates.TemplateParser.ResolveType(String tag) +608
       Telerik.Sitefinity.Web.UI.Templates.TemplateParser.CreateObjectBuilder(HtmlChunk chunk) +171
       Telerik.Sitefinity.Web.UI.Templates.TemplateParser.ParseOpenTag(HtmlChunk chunk) +228
       Telerik.Sitefinity.Web.UI.Templates.TemplateParser.ParseChunk(HtmlChunk chunk) +86
       Telerik.Sitefinity.Web.UI.Templates.TemplateParser.Parse() +191
       Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.ParseHtml(TemplateParser parser) +88
       Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder.ParseHtml(String html) +84
       Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder..ctor(ObjectBuilder parent, String html) +60
       Telerik.Sitefinity.Web.UI.Templates.ObjectBuilder..ctor(ObjectBuilder parent, String html, String templatePath) +40
       Telerik.Sitefinity.Web.UI.Templates.ControlBuilder..ctor(ObjectBuilder parent, String html, String templatePath) +43
       Telerik.Sitefinity.Web.UI.Templates.RootBuilder..ctor(String templatePath, String html, ObjectBuilder parent) +43
       Telerik.Sitefinity.Web.UI.Templates.RootBuilder..ctor(String templatePath, String html) +42
       Telerik.Sitefinity.Web.UI.StringTemplate..ctor(String declaration, String templateName) +61
       Telerik.Sitefinity.Web.UI.ControlUtilities.GetTemplate(String virtualPath, String resourceFileName, Type assemblyInfo, String templateDeclaration) +1396
       Telerik.Sitefinity.Web.UI.ControlUtilities.GetControlTemplate(TemplateInfo info) +874
       Telerik.Sitefinity.Web.UI.ControlUtilities.GetTemplate(TemplateInfo info) +1190
       Telerik.Sitefinity.Web.UI.SimpleView.get_LayoutTemplate() +257
       Telerik.Sitefinity.Web.UI.SimpleView.get_Container() +54
       Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +72
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

  • Hi Gary C,

    The error from your first message seems to be caused by missing handler configurations in the web.config file of the Sitefinity website. The ReportViewer needs the bellow handler added:
    for IIS 6.0
        <add path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
          validate="true" />

    for IIS 7.0
        <add name="Telerik.ReportViewer.axd_*" path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" preCondition="integratedMode" />

    The error from the second post is caused because a reference to one of the required assemblies has not been added to the JobsModule project. Required minimum assemblies are Telerik.Reporting and Telerik.ReportViewer.WebForms. More information on how to use the ReportViewer on WebApplications can be found in the bellow two articles:
    Telerik Reporting Q1 2011
    How to: Add report viewer to a web page

    Radoslav Georgiev
    the Telerik team