hi,
we're struggled quite a lot with building telerik reports using the new Q1 2015 report builder and are hopefully at the final hurdle.
We've built a report using an entitydatasource pointed at a function written in the DbContext project, GetOrderById(int id). This produces an invoice output which now works in the designer.
When we run it in our application using the webforms report viewer (for compatability purposes) it keeps trying to create a local database instead of reading the sql server connection of the context we've passed in to it.
Here is the runtime code that i've bound to the page_load event of a page (for getting it working purposes)
Dim source = New Telerik.Reporting.UriReportSource() source.Uri = "web/apps/shared/InvoiceReport2.trdx" Dim report = New Telerik.Reporting.Report Dim ds As New EntityDataSource() Dim context = New DataContext(connectionString) // passed in as a text string and is 100% valid
ds.Context = context ds.ContextMember = "GetOrderForReports" ds.Parameters.Add("OrderId", GetType(Integer), 89720) report.DataSource = ds ReportViewer1.ReportSource = source ReportViewer1.RefreshReport()the error we get is as below. any help would be great, cheers.
An error has occurred while processing Report 'invoicereport2': An error occurred while invoking data retrieval method. ------------- InnerException ------------- Exception has been thrown by the target of an invocation. ------------- InnerException ------------- Directory lookup for the file "D:\xxxxxx\WebSites\xxxxx\App_Data\xxxxx.mdf" failed with the operating system error 2(The system cannot find the file specified.). CREATE DATABASE failed. Some file names listed could not be created. Check related errors. Hi,
I was trying out with Reporting and added report viewer to the project. But i'm not able to add any other items as all the items are seems to be locked. Check out the screen shots attached to get better idea on what i'm talking about.
If we enable show all. All the items are seen but locked. Only report viewer is enabled.
If you guys have an answer please reply to this thread.
Thanks in advance.
Swaroop
int count = 0;var rowGroups = this.crosstab1.RowGroups;while (rowGroups != null){ foreach (var group in rowGroups) { if (hideColumnIndexes.Contains(count)) { group.ReportItem.Width = new Telerik.Reporting.Drawing.Unit(0.000000, Telerik.Reporting.Drawing.UnitType.Inch); } } if (rowGroups.Any()) { rowGroups = rowGroups[0].ChildGroups; } else { rowGroups = null; } count++;}public Report1(LINQToSQLDataContext dataContext){ // // Required for telerik Reporting designer support // InitializeComponent(); // custom constructor actions this.DataContext = context; // for debugging detail.ItemDataBound += new EventHandler(detail_ItemDataBound); this.detail.ItemDataBinding += new EventHandler(detail_ItemDataBinding); // force NeedDataSource to fire this.DataSource = null; this.NeedDataSource += new EventHandler(Report1_NeedDataSource); this.Error += new ErrorEventHandler(Report1_Error); // replace the subReport in order to pass it the MyContactMethodController to replace its static DataSource Report2 emailReport = new Report2SubReport(this.MyContactMethodController); this.Report2SubReport.ReportSource = new InstanceReportSource() { ReportDocument = emailReport }; this.Report2SubReport.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("parameter1", "=Fields.ID")); this.Report2SubReport.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("effectiveDate", "=Parameters.effectiveDate.Value"));} #region Event Handlers void Report1_NeedDataSource(object sender, EventArgs e){ Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender; var id = report.Parameters["ID"].Value; _ID = Convert.ToInt32(ufdID); var effectiveDT = report.Parameters["effectiveDate"].Value; _effectiveDate = Convert.ToDateTime(effectiveDT); this.DataSource = this.MyDataController.GetHighLevelInfo(_ID, _effectiveDate);} // for debuggingvoid Report1_ItemDataBinding(object sender, EventArgs e){ int? id = (((Telerik.Reporting.Processing.ReportItemBase)(sender))).DataObject.RawData as int?;} // for debuggingvoid detail_ItemDataBinding(object sender, EventArgs e){ Telerik.Reporting.Processing.ReportSection reportSection = sender as Telerik.Reporting.Processing.ReportSection; HighLevelInfo data = reportSection.DataObject.RawData as HighLevelInfo; _ID = data.ID;} // for debuggingvoid detail_ItemDataBound(object sender, EventArgs e){ Telerik.Reporting.Processing.ReportSection reportSection = sender as Telerik.Reporting.Processing.ReportSection; var data = reportSection.DataObject.RawData;} void Report1_Error(object sender, ErrorEventArgs eventArgs){ throw new Exception(string.Format("{0} Telerik Report Exception: {1}", this.Name, eventArgs.Exception.ToString()), eventArgs.Exception);}#endregion Event Handlerspublic Report2(DataController dc){ // // Required for telerik Reporting designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // // save controller for the NeedDataSource event handler this.MyDataController = dc; // force NeedDataSource to fire this.DataSource = null; this.NeedDataSource += new EventHandler(Report2_NeedDataSource); this.Error += new ErrorEventHandler(Report2_Error); // replace the subReport in order to pass it the MyDataController Report3 report3 = new Report3(this.MyDataController); // force NeedDataSource to fire report3.DataSource = null; this.Report3SubReport.ReportSource = new InstanceReportSource() { ReportDocument = report3 }; this.Report3SubReport.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("parameter1", "=Parameters.parameter1.Value")); this.Report3SubReport.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("parameter2", "=Parameters.effectiveDate.Value")); this.Report3SubReport.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("parameter3", "=Fields.ID")); this.Report3SubReport.ReportSource.Parameters.Add(new Telerik.Reporting.Parameter("parameter4", "=Fields.Name"));} private DataController MyDataController { get; set; } private void Report2_NeedDataSource(object sender, EventArgs e){ int parameter1 = Convert.ToInt32(this.ReportParameters["parameter1"].Value); DateTime effectiveDate = Convert.ToDateTime(this.ReportParameters["effectiveDate"].Value); List<DetailInfo> detailList = this.MyDataController.GetDetailInfoList(parameter1, effectiveDate); this.DataSource = detailList;} void Report2_Error(object sender, ErrorEventArgs eventArgs){ throw new Exception(string.Format("{0} Telerik Report Exception: {1}", this.Name, eventArgs.Exception.ToString()), eventArgs.Exception);}public Report3(DataController dc){ // // Required for telerik Reporting designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // // save controller for the NeedDataSource event handler this.MyDataController = dc; // force NeedDataSource to fire this.DataSource = null; this.NeedDataSource += new EventHandler(Report3SubReport_NeedDataSource); this.Error += new ErrorEventHandler(Report3SubReport_Error);}private DataController MyDataController { get; set; }private void Report3SubReport_NeedDataSource(object sender, EventArgs e){ int parameter1 = Convert.ToInt32(this.ReportParameters["applicantUserFormDetailID"].Value); DateTime effectiveDate = Convert.ToDateTime(this.ReportParameters["effectiveDate"].Value); int parameter3 = Convert.ToInt32(this.ReportParameters["skillCategoryID"].Value); List<MoreDetailInfo> moreDetailInfoList = this.MyDataController.GetMoreDetailInfo(parameter1, parameter2, effectiveDate); // bind datasource directly to my table. Binding to this.DataSource leaves the table blank. this.MyTable.DataSource = moreDetailInfoList;}void Report3SubReport_Error(object sender, ErrorEventArgs eventArgs){ throw new Exception(string.Format("{0} Telerik Report Exception: {1}", this.Name, eventArgs.Exception.ToString()), eventArgs.Exception);}