Solved

Unable to use ReportViewer in asp.net web forms application

Posted on 2014-03-02
11
8,867 Views
Last Modified: 2014-06-07
I have installed the ReportViewer version 11 download and am struggling to get it to work at all in Visual Studio 2013.  

I created an empty web ASP.Net Web application and add a webform.  To this aspx I drag from the toolbox a ScriptManager control as well as a ReportViewer control.  Doing this adds the following line at the top of the file:

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

Open in new window


I check references and see that Microsoft.ReportViewer.WebForms exists and is of version 11.


 Finally here is my updated Web.config:

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>
  <system.web>

    <httpHandlers>
      <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </httpHandlers>



    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
</configuration>

Open in new window


Running the project gives the following error:

0x800a1391 - JavaScript runtime error: 'Microsoft' is undefined

Open in new window

0
Comment
Question by:canuckconsulting
  • 5
  • 3
11 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 39899134
Did you add script manager control before adding ReportViewer control?
Typical steps are:
1. Add a page.
2. Open the Toolbox window. From the AJAX Extensions group, drag a ScriptManager control onto the design surface.

3. From the Toolbox window, in the Reporting group, drag a ReportViewer control onto the page below the ScriptManager control.
0
 

Author Comment

by:canuckconsulting
ID: 39899152
Yes, did that exactly.

I've uploaded the test solution here in case it helps:

Solution
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 39912414
What line are you getting this error from?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:canuckconsulting
ID: 39932443
I am so sorry for the late reply!

I get the error from here from the line beginning "$create(Microsoft.Reporting.WebFormsClient":

<script type="text/javascript">
//<![CDATA[
Sys.Application.add_init(function() {
    
if (typeof Microsoft == 'undefined' ||
    typeof Microsoft.Reporting == 'undefined' ||
    typeof Microsoft.Reporting.WebFormsClient == 'undefined' ||
    typeof Microsoft.Reporting.WebFormsClient.ReportViewer == 'undefined')
    Sys.UI.DomElement.setVisible($get('ctl00_ContentPlaceHolder1_ReportViewer1_HttpHandlerMissingErrorMessage'), true);
    $create(Microsoft.Reporting.WebFormsClient.ReportViewer, {"_internalViewerId":"ctl00_ContentPlaceHolder1_ReportViewer1_ctl03","id":"ctl00_ContentPlaceHolder1_ReportViewer1"}, null, null);
});

Open in new window


The error I receive is:

error
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 39932751
Please give me time to retrace my own solution.

I had EXACTLY  the same problem two or three months ago but I can't remember how I resolved it.

I will be once I remember.
0
 

Author Comment

by:canuckconsulting
ID: 39938522
I'd be very grateful if you can help1  My deadline is rapidly approaching and I have no idea how I'm going to get this sorted.

Thanks,

Scott
0
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 39938746
Sorry, I am under the gun too.

My app goes LIVE tomorrow, yea.

I will then dedicate more time to helping you out.

In the meantime, review this link and see how helpful it might be for you.

It is my understanding that because IIS7 handler mappings does not contain reserved word when placed in the handler section. As a result these suggested workarounds might do it.

http://otkfounder.blogspot.com/2007/11/solving-reportviewer-rendering-issue-on.html

I will have a little more time tomorrow to look into my folders.
0
 

Author Comment

by:canuckconsulting
ID: 39945921
Thanks very much for the link.

Unfortunately those tips have not done the trick for me. I 'm really stuck on this as I can't get this control to work on either my Windows 8 laptop running Visual Studio 2013 nor my w7 machine running Visual Studio 2012.

Could I trouble someone to download the project I uploaded and see if it works on another environment?  Or alternatively build the smallest asp.net solution with the report viewer in a page and upload it so I can see if it works on my system?

Many thanks,
0
 

Author Closing Comment

by:canuckconsulting
ID: 40119469
Once I added the following worked great.  Thank you for your help!


  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </handlers>
  </system.webServer>
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to prevent website from publishing with errors 9 46
Deploying to Azure 3 27
ASP.NET MVC -Add authentication 2 21
performance query 4 20
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question