I'm new to reporting so maybe I'm missing something basic here.
I have a .NET web application. I have a ReportViewer tied to a Report on a page. At runtime I want to programatically assign a LinqToSql query to the report control. I've tried doing this (see code) but I get the following error on the report viewer:
An error has occurred while processing Report 'ARQSort': Cannot access a disposed object. Object name: 'DataContext accessed after Dispose.'.
What am I missing?
I have a .NET web application. I have a ReportViewer tied to a Report on a page. At runtime I want to programatically assign a LinqToSql query to the report control. I've tried doing this (see code) but I get the following error on the report viewer:
An error has occurred while processing Report 'ARQSort': Cannot access a disposed object. Object name: 'DataContext accessed after Dispose.'.
namespace CMS{ public partial class ARQSort : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { CMS.Reports.ARQSort report1 = new CMS.Reports.ARQSort(); using (CMSDatabaseDataContext myCMSDataContext = new CMSDatabaseDataContext()) { IEnumerable<arq_recipient> arqSortQuery = (from a in myCMSDataContext.arq_recipients where a.fdc_accepted == true select a); // Assigning the ObjectDataSource component to the DataSource property of the report. report1.DataSource = arqSortQuery; Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = report1; ReportViewer1.ReportSource = instanceReportSource; } } }}What am I missing?