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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:22:42+00:00 2026-06-07T10:22:42+00:00

I am trying to create a Crystal Report with a dynamic data source. When

  • 0

I am trying to create a Crystal Report with a dynamic data source. When i click the report button, the crystal report shows up just fine, but when i click any button the Crystal Report tool bar (i.e. Next page, Export To, etc.), i get a pop with the Error “No valid report source is available.”

Here is what my C# code looks like:

private void GenerateReport()
{
    using (DataContext reports = new DataContext())
    {
        var results = //Linq Query;

        ReportDocument pr = new ReportDocument();
        pr.Load(Server.MapPath(@"CrystalReport1.rpt"));
        pr.SetDataSource(results.ToList());

        CrystalReportViewer1.ReportSource = pr;
        CrystalReportViewer1.DataBind();
    }
}

Any help would be greatly appreciated. Thanks in advanced.

  • 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-06-07T10:22:44+00:00Added an answer on June 7, 2026 at 10:22 am

    So, I could not get this working with the other way, but i did get it to work going about it a different way. First, i added a CrystalReportSource control to the aspx page,

    <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
       <Report FileName="CrystalReport1.rpt">
      </Report>
    </CR:CrystalReportSource>
    

    Then in the code behind file, instead of setting the datasource directly to CrystalReportViewer1, i set it to CrystalReportSource, then i set that as the report source for CrystalReportViewer1. Now everything works just fine!

    using (DataContext reports = new DataContext())
    {
        var results = //Linq Query;
        CrystalReportSource1.ReportDocument.SetDataSource(results.AsEnumerable());
    
        CrystalReportViewer1.ReportSourceID = "CrystalReportSource1";
        CrystalReportViewer1.RefreshReport();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Crystal Report that reads data from an access table.
I am trying to create a crystal report, but I want the connection string
I am trying to create a crystal report and I am new to that
I am trying to create a report in crystal reports 11 based on this
I'm trying to export a Crystal Report to a text file, while preserving any
I am trying to create a crystal report, however I cannot connect directly to
I am trying create a delegate representation of constructor by emitting a Dynamic Method,
Trying to create a black line in my view to separate text blocks but
Trying to create a facebook app just to learn and coming across a strange
Trying to create a new Dedicated Cache Role in Windows Azure but get the

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.