ASP. net mvc application displays RDLC reports

Source: Internet
Author: User

Learning ASP. net mvc for a long time, in the process of learning, practice and application, I feel a lot of knowledge with the previous ASP. NET has many differences, but there are many similarities in implementation operations.

This article describes how to use RDLC reports in ASP. net mvc applications. In the implementation process, Insus. NET will also list some common problems and provide solutions.

First, we prepare data, tables, stored procedures, and so on in the database, and apply the data that we practiced before to write a stored procedure.

 

Under the Entities under the directory structure of ASP. net mvc application, find an Entity that was previously written and add a method:

 

Under Reports of the application, create the RDLC report:

 


Select the Table tool on the left and drag a Table in Design on the right.

 

After the left mouse button is opened, the following dialog box is displayed:



If the dialog above does not appear after the left mouse button is opened, click the Data table with mouse, as shown below:

The following menu is displayed:


In the table, select the fields to be displayed and save:

 

Next, we will create an RdlcView. aspx webpage to add the left RDLC report:

 

In RdlcView. aspx. cs, write the program:

 

Create an Action in the Controller. You can see how to load the aspx webpage. For more related exercises, refer:

ASP. net mvc WebForm Web page or UserControl control http://www.cnblogs.com/insus/p/3641610.html

ASP. net mvc display UserControl controls (extensions) http://www.cnblogs.com/insus/p/3642634.html

ASP. net mvc after loading ASCX, and assign value to the http://www.cnblogs.com/insus/p/3643254.html

ASP. net mvc after loading the user control and get the control value or assign value to the http://www.cnblogs.com/insus/p/3644602.html

 

Create a view:

 

Let's look at the effect, but an exception occurs when the webpage is running:

Add to Web. config by referring to Heighlight:

View Code

 

Run again with another exception:

Solution: In References, check the related Microsoft. ReportViewer. Common and Microsoft. ReportViewer. WebForms versions:

 

Let's look at the version of Reportviewer:

 

One is version 10 and the other is version 11. We remove the References

 

 

Use NuGet to install the matching version:

 

Browsing again, succeeded:

 

Another exception occurs when you click the next page:


Error message:
Line: 885
Error: Sys. WebForms. PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404


Solve it. In the ScriptManager syntax, add an attribute: EnablePartialRendering = "false"


Click to print:

 

It prompts you to install ActiveX:



Then, the following dialog box is displayed:

 

You can also export Word, PDF, and Excel:

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.