Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1027537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:15:16+00:00 2026-05-16T12:15:16+00:00

Basically I want to know how to embed a report into MVC.Net 2.

  • 0

Basically I want to know how to embed a report into MVC.Net 2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:15:16+00:00Added an answer on May 16, 2026 at 12:15 pm

    I did the question, because there’s not enough information on the web, or the information is not that complete so you can start working.

    The first thing you have to know is that the report viewer is a webcontrol so you can’t use it on MVC, so first thing you have to do is create a web form so you can add the report viewer. In the example I’ve done I’m using Visual Studio 2010.

    The webform looks like this:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Report Viewer</title>
    </head>
    <body>
        <div style="width: auto;">
            <form id="form1" runat="server" style="width: 100%; height: 100%;">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <rsweb:ReportViewer ID="rptViewer" runat="server" Width="100%" Height="100%" AsyncRendering="False"
                SizeToReportContent="True">
            </rsweb:ReportViewer>
            </form>
        </div>
    </body>
    </html>
    

    The code behind of the web form:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var reportServer = ConfigurationManager.AppSettings["ReportServer"].ToString();
            var reportPath = ConfigurationManager.AppSettings["ReportPath"].ToString();
    
            rptViewer.ServerReport.ReportServerUrl = new Uri(reportServer);
            rptViewer.ShowToolBar = false;
            rptViewer.ServerReport.ReportPath = reportPath + Request.QueryString["ReportName"];
            List<ReportParameter> parameters = new List<ReportParameter>();
            string[] keys = Request.QueryString.AllKeys;
            for (int i = 1; i < Request.QueryString.Count; i++)
            {
                parameters.Add(new ReportParameter(keys[i], Request.QueryString[i]));
            }
            this.ReportViewer1.ServerReport.SetParameters(parameters);
            this.ReportViewer1.ProcessingMode = ProcessingMode.Remote;
            this.ReportViewer1.ShowParameterPrompts = false;
            this.ReportViewer1.ShowPromptAreaButton = false;
            this.ReportViewer1.ServerReport.Refresh();
    
            rptViewer.ProcessingMode = ProcessingMode.Remote;
            rptViewer.ServerReport.Refresh();
        }
    }
    

    Now we need to use the MVC. We have two options one, open a new window with a javascript pop up or use an iframe.

    I will do both so you can have a best idea on the View:

    <iframe id="Frame1" src="<%= Session["Url"] %>" width="230" height="230" frameborder="0"></iframe> **1
     function OpenReports(name) {
                var width = (screen.availWidth - 700).toString();
                var height = (screen.availHeight - 100).toString();
                window.open('/Reporting/Reports.aspx?ReportName=' + name,
                     'mywindow', 'width=' + width + ',height=' + height + ',toolbar=no,location=no,directories=yes,status=no,' +
                    'menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes' + ',screenX=0,screenY=0,left=0,top=0');
    
            } **2
    

    **1 SessionURL is a Session Variable with the path and report we want to show. Also this is the first way to do embed the Report using an iframe

    **2 /Reporting/Reports.aspx is the path of the webform we just did eaelier. This is the second way, opening a new window.

    In the Controller:

     public ActionResult ViewName()
     {
        Session["Url"] = "/Reporting/Reports.aspx?ReportName=Report44";
        return View();
     }**1
    

    **1 /Reporting/Reports.aspx is the path of the webform we just did eaelier.

    Also If your are using Report Viewer 10 please remember this feature in the web.config:

    <system.web>
        <httpHandlers>
          <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </httpHandlers>
    </system.web>
    

    Hope all this tutorial helps somebody 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I basically want to know what the system's input language is currently on (for
Basically, I want to know what is best to avoid future problems and confusions
Basically, I just want to know if its possible to use Nhibernate to migrate
I am new to networking. I just basically want to know whether we can
I have an iframe setup within a page and basically want to know whether
Basically I want to know if a given nodes children are visible in a
I basically want to know how GAE has implemented its indexing, I'm familiar with
Basically I want to know which one of is better for accessing cube using
Basically I want to know how to set center alignment for a cell using
Basically I want to know if apps work and store data independent of one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.