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 4057946
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:01:04+00:00 2026-05-20T15:01:04+00:00

I have asp.net MVC2 application. I am using VS2008 and want to hook up

  • 0

I have asp.net MVC2 application.
I am using VS2008 and want to hook up generated report from my controller to reportviewer.

any ideas?

so far i have this code
“Controller”

//should pass data to report
 public ActionResult GenerateReport()
      {


        LocalReport report = new LocalReport();
        report.ReportPath = Server.MapPath("~/Reports/KingsCourt.rdlc");

        List<InvoiceRow> rows = new List<InvoiceRow>();

        rows.Add(new InvoiceRow { name = "Testing item", value = (decimal)25.85 });
        rows.Add(new InvoiceRow { name = "Testing item2", value = (decimal)5.15 });
        ReportDataSource source = new ReportDataSource("InvoiceRow", rows);
        report.DataSources.Add(source);

        ViewData["InvoiceRow"] = report;
        return View();
      }

and View page:

 <form id="form1" runat="server">

  <h2>GenerateReport</h2>
  <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
      Font-Size="8pt" Height="400px" Width="400px">
    <LocalReport ReportPath="Reports\KingsCourt.rdlc">
      <DataSources>
        <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="InvoiceRow" />
      </DataSources>
    </LocalReport>


  </rsweb:ReportViewer>    

  <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="Rows" 
      TypeName="Accounts.Classes.Invoices"></asp:ObjectDataSource>
 </form>
  • 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-20T15:01:05+00:00Added an answer on May 20, 2026 at 3:01 pm

    You can always use ASP.NET WebForms with MVC. I guess this is the only way to do it.
    I’ve prepared a sample for you here.

    You can create a folder where you’re going to put your asp.net WebForm and the report (rdlc).
    I’ve put in the same folder the schema (xsd) and the data (xml) but, obviously, I guess you’re going to use the database.
    I’ve mapped the route to the report(s) like this:

        //Custom route for reports
        routes.MapRoute(
         "ReportRoute",
         "Reports/{reportname}",                
         "~/Reports/{reportname}.aspx"
         );
    

    UPDATE:

    I have prepared some code for ASP.NET MVC3 (MvcReportViewerMVC3).
    It is pretty much the same with some minor changes on the webform: I’ve integrated the new ReportViewer (10) and I had to add the ScriptManager to the same page:

    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    

    I’ve changed the WebForm code as well cause it appears that page_load event is called loads of times:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
        ....
        }
    }
    

    Hope it helps.

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

Sidebar

Related Questions

i m using asp.net mvc2 for my application. i have a view that accepts
I have ASP.NET web pages for which I want to build automated tests (using
I have an Asp.NET application (VS2008, Framework 2.0). When I try to set a
Following on from this question: ASP.NET MVC Routing with Default Controller I have a
I have an ASP.NET MVC 2 application with a custom StructureMap controller factory to
I have a ASP.NET application that we've written our own logging module for. My
I have a ASP.NET 1.1 application, and I'm trying to find out why when
I'm building a small web application with ASP.NET MVC 2, using db4o as a
I am trying out some globalization in an asp.net mvc2 application but can't get
How do I debug code in the View in asp.net mvc2 application? Edit after

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.