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

  • Home
  • SEARCH
  • 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 98927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:17:23+00:00 2026-05-11T00:17:23+00:00

We are using the MVC framework (release 5) and the CrystalReportViewer control to show

  • 0

We are using the MVC framework (release 5) and the CrystalReportViewer control to show our reports. I cannot get any of the buttons at the top of the report viewer control to work.

If I’m working with the report ‘HoursSummary’. If I hover over any of the buttons on the report viewer in IE the displayed link at the bottom of the pages is ‘../HoursSummary’. This creates a url of ‘http://localhost/HoursSummary‘. There is no ‘HoursSummary’ controller so I keep receiving 404 errors.

  • I believe I want to redirect to ‘http://localhost/reports/HoursSummary‘ since I do have a reports controller. If this is the correct method does anyone know which property I should set on the CrystalReportViewer control to make that happen?
  • Is there an easier method to handle this situation?
  • 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. 2026-05-11T00:17:24+00:00Added an answer on May 11, 2026 at 12:17 am

    We were able to get the report viewer to work and have been using it for the past few months in production without any issues.

    • We have a reports controller that lists links to the reports we want to run
    • Clicking on one of the links will make an ajax call to the back end and return a partial page where we can fill in all the parameters we need.
    • After the parameters are filled out we submit the form to ‘\reports\Name of Report’.
    • Back in the Reports controller we call SQL, return our data, and then call a different view called ‘Full Report’
    • The ‘Full Report’ View only has a crystal report viewer control on it where it automatically takes the report data we pass over to it through ViewData, populates the report, renders it, and sends it to the user

    Everything seems to work great.

    UPDATE

    I’ve added some code and clarification to the steps I originally listed above. The key item I left out was there is some code behind with the final View so it will work with Crystal Reports. The code behind is minimal, but needed. For Crystal Reports to work you are going to end up with the following files:

    • A layout file.rpt where you design the report
    • A aspx file that holds the Crystal Reports Report control. This is the file that will have some code behind.

    Details on how to create a View that will work with Crystal Reports:

    • Create the layout of your report using the Crystal Reports Designer. The resulting file will be an .rpt file. For the sake of this example, let’s call this file AllJobsSummaryReportLayout.rpt.
    • While designing your report, for the ‘Database Fields’ select one of the business entities or DTOs that holds the results coming back from SQL.
    • A quick aside, we have a few data transfer objects (DTOs) in our system that contain nothing more than scalar values and strings, there is no intelligence in these DTOs. When the Controller is called, it calls the Model, the Model for most of these reports returns a List of DTOs that we then pass to the View to be rendered. These DTOs do not know how to query themselves, display themselves, they only contain actual values returned from SQL that someone else then renders.
    • Once the layout Crystal Report file is completed, the AllJobsSummaryReportLayout.rpt, we design our Controller. In the Controller we take in any parameters needed to run the report, call the Model, Model returns our list of DTOs, as seen in the snippet below from the Controller:

      var reportViewData = model.AllJobsSummaryQuery(startDate, endDate); if (0 != reportViewData.Count()) {     var report = new AllJobsSummaryReportLayout();     report.SetDataSource(reportViewData);     report.SetParameterValue('startDate', startDate);     report.SetParameterValue('endDate', endDate);     ViewData['ReportData'] = report;     returnView = 'AllJobsSummaryView'; } else     returnView = 'noReportView'; return View(returnView); 
    • Note a couple of items here, we are creating a varible ‘report’ that is a type of the Crystal Report layout file, AllJobsSummaryReportLayout.rpt, that we created above.

    • Once we created the ‘report’ variable we set the data source values and any parameters we need, and bundle the item up into the ViewData.

    • Now let’s take a look at AllJobsSummaryView.aspx. This file has a form on it with a Crystal Reports Viewer and a code behind file:

    <%@ Page Title='All Jobs Summary Report' Language='C#' AutoEventWireup='true' CodeBehind='AllJobsSummaryView.aspx.cs' Inherits='V.Views.Reports.AllJobsSummaryView'%>      <%@ Register Assembly='CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' Namespace='CrystalDecisions.Web' TagPrefix='CR' %>  <form id='form1' runat='server'> <div> <a href='/Reports' id='Report'><< Return to Report Main     Page</a><br /> <CR:CrystalReportViewer ID='ReportViewer' runat='server' AutoDataBind='True' EnableDatabaseLogonPrompt='False'     EnableParameterPrompt='False' HasCrystalLogo='False' DisplayGroupTree='False'      HasDrillUpButton='False' HasToggleGroupTreeButton='False' HasViewList='False'      HasSearchButton='False' EnableDrillDown='False' EnableViewState='True'      Height='50px' ReportSourceID='CrystalReportSource1' Width='350px' />     <CR:CrystalReportSource ID='CrystalReportSource1' runat='server'>     <Report FileName='AllJobsSummaryReportLayout.rpt'>     </Report> </CR:CrystalReportSource> </div> </form> 
    • And the code behind file:

       using System;  using System.Collections.Generic;  using System.Linq;  using System.Web;  using System.Web.Mvc;   namespace V.Views.Reports  {     public partial class AllJobsSummaryView : ViewPage     {         protected void Page_Init(object sender, EventArgs e)         {             ReportViewer.ReportSource = ViewData['ReportData'];         }          protected void Page_Unload(object sender, EventArgs e)         {             ((AllJobsSummaryReportLayout)ViewData['ReportData']).Close();             ((AllJobsSummaryReportLayout)ViewData['ReportData']).Dispose();         }     }  } 
    • The Page_Unload is key, without it you will have an error generated by Crystal Reports ‘You have exceeded the max number of reports set by your administrator.’

    This method is still working in a production environment for well over two years now.

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

Sidebar

Ask A Question

Stats

  • Questions 75k
  • Answers 75k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I found a blog entry that has a solution in… May 11, 2026 at 2:38 pm
  • added an answer This appears to be a bug in the library. Do… May 11, 2026 at 2:38 pm
  • added an answer Conversion not allowed. Add new column as ntext then copy… May 11, 2026 at 2:38 pm

Related Questions

My team is considering building our next web app using the ASP.NET MVC framework.
We are working on a website for a client that (for once) is expected
Which MVC-framework is the best option (performance/ease of development) for a web application, that
I'm building a MVC web application (using the Spring MVC framework), and I'm a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.