Category Archives: ReportViewer

ReportViewer

[RESOLVED]using RDLC in MVC projects

We have a MVC 4.0 project and for reporting we used RDLC. We need to have the reportviewer control available in client page, because we want our web application to be very similar with a desktop application.

To work with RDLC we have to use aspx pages inside our project which are loaded inside iframe based on src=… path.

We store these files in Reports folder inside our project.

Everything was working in our development process. We use Visual Studio 2013 with IIS Express.

When we have done the deployment to the production server, we observe that our reports are not working. We receive the 404 error. We have received the same 404 error from Windows Server 2008 SBS and from Windows Server 2012 Standard where we have made the
deployment

Please help us with this issues.

Thank you very much

You may look into using the Reports as "Local Reports" and simply using MVC to render them via their path (instead of navigating to them directly, which would require routing changes). I recently implemented a similar structure to support accessing
data via Entity Framework to populate to populate a few RDLC Reports that I had created. Although this may not be exactly the approach that I took, I would recommend

taking a look at this blog post on the topic
.

If you don’t want to take that approach and would prefer to render an actual Report Viewer directly within an MVC View (or navigate to an ASPX page that contained your report), you might be better off using an approach
like this one.

Hi horia,

First, please refer to Rion’s reply.

Secondly, please use
Server.MapPath
to generate the path dynamically.

On the other hand, there are some articles about report that can help you:

# ASP.NET MVC Html Helpers for ReportViewer Control.

https://github.com/ilich/MvcReportViewer

# Prototype MVC4 Razor ReportViewer? RDLC

http://www.codeproject.com/Articles/609580/Prototype-MVC-Razor-ReportViewer-RDLC

Best Regards

Starain Chen

if you have internet explorer greater than I.E 8. There is something called developer tools (press F12). on network tab you can start monitoring.

Find the url which is giving 404. Hit the url separately from new tab in the browser, check if you are getting the same 404.

Find the url which is working in you dev environment, get the url from there. Find the difference between working and non working url. It could be because of cross posting, domain bieng different, url bieng wrong, insufficient file permission for files in
reports folder. If there are physical file, you might also want to set it up as static file at IIS level or in web.config

In the first approach I can not see report toolbar at client. I want that client to be able to navigate from page to page, choose option to export in XLS, PDF.Doc, to be able to print and to choose the printer like in desktop application.

second approach I have to test in the next days and I will let you know.

But I have one very logical question. Why it is working in developing with IIS Express and is not working in production server with IIS. For me this is unbelievable.

Thanks for reply

Of course I have tried with network monitoring and the same path in the IIS express is working fine, but In production environment IIS give 404 error.

IIS Express example:

<iframe width="99.5%" height="99%" id="myReport" src="….ReportsRaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&amp;idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&amp;Format=FACT&amp;lcnrZecimaleCantitate=3&amp;lcnrZecimalePret=2&amp;lcnrZecimaleValuta=2"
frameborder="1"></iframe>

URL Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎
/Reports/RaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&Format=FACT&lcnrZecimaleCantitate=3&lcnrZecimalePret=2&lcnrZecimaleValuta=2 GET 200 text/html 58.79 KB 0.67 s frame
navigate 2465 0 655 16 0 1014

is working well

 

IIS production server example:

<iframe width="99.5%" height="99%" id="myReport" src="….ReportsRaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&amp;idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&amp;Format=FACT&amp;lcnrZecimaleCantitate=3&amp;lcnrZecimalePret=2&amp;lcnrZecimaleValuta=2"
frameborder="1"></iframe>

URL Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎
/Reports/RaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&Format=FACT&lcnrZecimaleCantitate=3&lcnrZecimalePret=2&lcnrZecimaleValuta=2 GET 404 text/html 1.70 KB 125 ms frame
navigate 63 0 125 0 0 13634

 

If we are looking to the calling path in  both cases are the same. The entire structure of the folders were copied from development server to the production. No good results.

Any idea?

Thank you.

 

Tkank you for your reply. I will begin to study again this approach and compare with article which you recommended.

Thank you

ReportViewer Control in MVC page style issue

Hi,

I have a ReportViewer Control issue in my CSHTML page. The issue is one of the drop down list in the report parameter is selected, it is displayed above the IE browser address bar. This is occurring when Dropdown have more data items and then it starts displaying
from the address bar to report data pane.  This issue is there in  IE11 and not in Chrome. Any suggestion?

Hi anulall,

How do you render ReportViewer control in the view? Please provide the detail code.

About doing report in MVC project, please refer to:

# Prototype MVC4 Razor ReportViewer? RDLC

http://www.codeproject.com/Articles/609580/Prototype-MVC-Razor-ReportViewer-RDLC

# MvcReportViewer HTML Helper

https://github.com/ilich/MvcReportViewer

Best Regards

Starain

Thank you for your time.

This is not a code issue I feel. When I access the report directly from report server , same behavior exists in IE 11.  

IE11 issue

[RESOLVED]Using rdlc with ASP.Net MVC 5 and EF6

I followed Dykstra’s tutorial series to switch form web forms development to MVC.  I did not see anywhere in that tutorial or any other resources I found on the web how to provide reports via rdlc, outputting PDF, Excel, ReportViewer, ….  I do know how
to choose which output to use.

I have a data context say MyContext with associated models, including reasons.cs.  I want to simply list the items in the Reason table.  I created a web form containing the script manager and the reportVIewer.  

How do I get to the info in the model to designate it as the recordset to use for the report?  Is everything done in the forms’c CodeBehind or is there a better way to integrate the MVC with the ReportViewer?  I have seen various examples of some ways to
do so, but none were successfully using references to the model but rather creating separate new datasets.

AFAIK You cannot directly show an SSRS Report in MVC application.The ReportViewer control requires ViewState to work, so you can’t place it in an MVC view.This doesn’t mean you can’t use it in your website, however You’ll just have to mix in a little bit
of classic WebForms(aspx) and use the ReportViewer there.

As a solution you can try the below mentioned steps

Add a webform page(Reports.aspx) to your solution and then load your reportviewer control and attach the ssrs report to the Reportviewer control. Next 

We need to have a place holder which will load the aspx page in MVC3 Razor. Use iframe for loading the aspx page

Add an iframe to your .cshtml page and assign the src to point to Reports.aspx page.

<iframe runat="server" id="Reports" src="~/Reports.aspx"
                    width="95%" height="460"></iframe>

Check the below links

Apart from this you can also check MvcReportViewer which is available in Nugget.

[RESOLVED]barcode on ReportViewer WEB

Using VS2010, aspnet4, c#

Does anyone know tutorial about printing barcode ReportViewer application Web

Hi,

To achieve this, we should first download a free barcode font. Try using "IDAutomationHC39M" from IdAutomation. And for more detailed information, you can refer the sample:

http://www.codeproject.com/Articles/30322/Barcodes-in-ASP-NET-applications

And please refer the similar thread

http://social.msdn.microsoft.com/Forums/vstudio/en-US/f2c3e9b2-506d-4660-a7bb-123addf5fa86/how-to-use-idautomationhc39m

Hope it can help you.

ASP.NET ReportViewer controll excel export bad cell background

I have a problem with the asp.net webforms reportviewer controll. When I export from this control to excel, the xls cells background colors goes wrong. All cells background color inherits the last cell background color.

The pdf and .doc export working well.

I’m using this exp. in the .rdlc file for coloring the cells: =IIF(Fields!State.Value = 0, "#FFFFFF", IIF(Fields!State.Value = 1, "#00FF00", IIF(Fields!State.Value = 2, "#FFFF00", IIF(Fields!State.Value = 3, "#FF0000", "#808080"))))

I hope somebody can help me.

Bye!

ps.: Sorry my english.

Hi,

try using Switch instead of IFF. Also, try giving the value in Color name like: Red instead of #FF0000

=Switch(Fields!State.Value = 0, "#FFFFFF",
Fields!State.Value = 1, "#00FF00",
Fields!State.Value = 2, "#FFFF00",
Fields!State.Value = 3, "#FF0000",
"#808080")

Source from http://stackoverflow.com/questions/17718176/asp-net-reportviewer-controll-excel-export-bad-cell-background

And you also try using “case when..then ..else..” expression like this:

SELECT
 Customers.CustomerID
 , Customers.CompanyName
 , Customers.Country
 , CASE Country
    WHEN 'Germany'
     THEN '0049 ' + Phone
    WHEN 'Mexico'
     THEN 'Fiesta ' + Phone
    WHEN 'UK'
     THEN 'Black Pudding (Yuk!) ' + Phone
     ELSE Phone
     END AS Phone
FROM
 Customers

For more detailed information, you can refer here

http://www.sql-server-performance.com/2006/iif-tsql/

Thanks for the tip, but it is not working. :(

[RESOLVED]Getting Error Sys.WebForms.PageRequestManagerTimeoutException; The server request timed out.

Hello All ,

I am using Ajax Extension 1.0, I am getting this error Sys.WebForms.PageRequestManagerTimeoutException; The server request timed out.

Also it is taking too long time to retrive 150 records to my webpage

Please help me.

To solve this problem we can increase the timeout. You can change the timeout time by adding a new property to the script manager control. This property is calledAsyncPostBackTimeOutand
it can help us to define the number of seconds before the request will throw a request timeout exception
*.

For example if you want that the timeout will take maximum 10 minutes your code should be look like this:

<asp:ScriptManagerID="ScriptManager1"runat="server"

AsyncPostBackTimeOut="600">

</asp:ScriptManager>  

The default value of theAsyncPostBackTimeOut property is 90 seconds.

http://blogs.msdn.com/b/selvar/archive/2012/06/18/reportviewer-2010-control-fails-with-sys-webforms-pagerequestmanagertimeoutexception-the-server-request-timed-out.aspx

Using business objects as data source for MS Report rdlcs with WAPs

Since there is no App_Code directory, I am unable to get my generics class to appear in the datasources for an rdlc that I create in my WAP project. 

I think there might be some limitation where we cannot use generics business objects as the datasource or reports since the WAP has no App_Code folder where the class must normally reside for the reporting datasources to pick it up as a datasource.

Any thoughts?  This will prevent my company from moving to 2005!

Here is what someone else used to work around the problem:

  1. <div class=MsoNormal> Drop an ObjectDataSource on the form with the ReportViewer.</div>
  2. <div class=MsoNormal>Configure the ODS to use the TableAdapter associated with the source DataSet.</div>
  3. <div class=MsoNormal>In the Misc->LocalReport properties for the ReportViewer, select DataSources and click the ellipsis.</div>
  4. <div class=MsoNormal>In the ReportDataSource Collection Editor, click the Add button.</div>
  5. <div class=MsoNormal>In the properties for the new ReportDataSource, specify <DataSet>_<table> as the value for the Name property and the ID of the ODS as the value for the DataSourceId property.</div>

 This results in the following ObjectDataSource tag:

 <asp:ObjectDataSource
ID="ObjectDataSource1"
runat="server"
OldValuesParameterFormatString
="original_{0}"
   
SelectMethod
="GetData"
TypeName
="ReportViewerCrash.DataSet1TableAdapters.databasesTableAdapter">
</asp:ObjectDataSource>

 

And the following ReportViewer tag: 

   
<
rsweb:ReportViewer
ID="ReportViewer1"
runat="server"
Font-Names
="Verdana"
Font-Size
="8pt" Height="400px"
Width="400px">
       
<
LocalReport ReportEmbeddedResource="ReportViewerCrash.Report1.rdlc"
ReportPath="Report1.rdlc">
           
<DataSources>
               
<rsweb:ReportDataSource
DataSourceId="ObjectDataSource1"
Name="DataSet1_databases"
/>
           
</DataSources>
       
</
LocalReport>    
   
</
rsweb:ReportViewer>

 

Hope this helps,

Brad.

The problem with this is you are creating a business object datasource from a dataset.

My approach is using a class that returns a generics class of my class type.  This normally is autodetected once compiled in a web site’s App_Code folder when you open an rdlc and look at the website datasource window.

It was confirmed that this is a bug with WAP’s that cannot be addressed until SP1.  The bug is the WebsiteDatasource window does not appear or update with the WAP generics classes.  I was told they are trying to find a workaround and will keep me posted.

I am correct in saying you are creating a dataset to bind to correct?  This is not going to work for the generics report object datasource approach right?

Greg

Hi Greg,

Were you able to resolve this issue? I am also having the same issue. I have a ASP.net Web application (and not a web site) and I want my classes as the data source for the report, but the classes do not show up in the data source window. I need to have
a report and bind to my business objects..

Your response really appreciated.

 

Report Designer Issues?

I rebuilt my computer and installed the VWD2008 instead of the VWD2005. I upgraded as the report viewer functions for 2008 were finally released. I pulled in a project build under 2005 and let it do it’s upgrading. Now I have issues with the report viewer
functions. I get an error in the developement control ie

Error Creating Control-ReportViewer1

Failed to created public designer ‘Microsoft.Reporting.Webforms.ReportViewer.Webforms, Version 8.0.0.0, Culture=neutral, PubicKey Token=b03f5f7f11d50a3a’

Looking at my web.config file I find two references to Microsoft.ReportViewer. A version 8.0.0.0 and a 9.0.0.0. Do I have a version error which wasn’t corrected in the upgrade?

<assemblies>

<add
assembly="Microsoft.ReportViewer.WebForms,
Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A
"/>

<add
assembly="Microsoft.ReportViewer.Common,
Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A
"/>

<add
assembly="Microsoft.ReportViewer.WebForms,
Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A
"/>

<add
assembly="Microsoft.ReportViewer.Common,
Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A
"/></assemblies>

 When I created a new report viewer it tells me

Error Creating Control-ReportViewer1

The server Tag ‘rsweb.ReportViewer’ is ambiguous. Please modify the associated registration that is causing the ambiguity and pick a new tag prefix. 

Any help?

UPDATE: Looking at the web.config file there are two references to Reportviewer version 8 and version 9. When the upgrade originally runs it does nothing to the web.config file and the program
will run fine and all reports can be run but have an error if tried to edit or view in development. If you build a new report with the new report viewer/builder for vwd2008 you will get two instances in the web.config file but will be able to edit in the development-The
problem comes when compiling-so many errors- It appears the reports developed in vwd2005 cause errors when tring to run it vwd2008. I have changed the web.config to a 2008 version and changed all the reports over to 2008 and I still get errors in the aaplication
code which stops it from running. For now I will have to revert back to 2005 until I can figure this out.

I solved the problem by doing the following.

  • <div mce_keep="true">I built another website under vwd2008. Build a dataset and report and report viewer.</div>
  • <div mce_keep="true">I copied the web.config file to a txt.doc</div>
  • <div mce_keep="true">I opened my site with the problems </div>
    • <div mce_keep="true">made a copy of the original web.config </div>
    • <div mce_keep="true">Copied and pasted my saved web.config from my txt.doc file location</div>
    • <div mce_keep="true">opened and copied my connections from my original web.config and pasted to my new web.config.</div>
    • <div mce_keep="true">You then have to go to every report viewer instance and change the reference from 8.0.0.0 to 9.0.0.0 and check your ObjectDataSource for missing parameters ie config the source to make sure its right. You have to fix them all to eliminate
      the errors.</div>
  • <div mce_keep="true">Now I am happy[Yes] and can get the reports to view that I want without pulling my hair out.</div>