This is a migrated thread and some comments may be shown as answers.

error occurred processing crosstab1

7 Answers 88 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
richard
Top achievements
Rank 1
richard asked on 06 Aug 2013, 11:05 AM
well the code below works fine on development machine but when moving it to the web i get the error in the graphic.

Here is the code:
private void crosstab1_NeedDataSource(object sender, EventArgs e)
{
  using (EntitiesModel dbContext = new EntitiesModel())
  {
    int dealid = Global.GetInt32(this.ReportParameters["dealID"].Value.ToString());
    int version = Global.GetInt32(this.ReportParameters["version"].Value.ToString());
    bool amended = Global.GetBool(this.ReportParameters["amended"].Value.ToString());
    bool postContract = Global.GetBool(this.ReportParameters["postContract"].Value.ToString());
    bool staging = Global.GetBool(this.ReportParameters["staging"].Value.ToString());
    bool commOption = Global.GetBool(this.ReportParameters["commOption"].Value.ToString());
 
    IEnumerable<rsDealsDealerOpt> d = dbContext.GetDealsDealerOptions(dealid, version, postContract, staging, amended, commOption);
 
    crosstab1.DataSource = d;
  }
Any thoughts on what is going on?

Thanks,
Richard

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 06 Aug 2013, 11:52 AM
Hello,

The correct way of utilizing parameter values in a report event handler is to take them from the Processing.Report.Parameters collection. This is explained more thoroughly  in the Using Report Parameters programmatically help article.

Here is the modified NeedDataSource event handler which should work as expected:

private void crosstab1_NeedDataSource(object sender, EventArgs e)
{
  var crosstab = (Telerik.Reporting.Processing.Table)sender;
  var parameters = crosstab.Report.Parameters;
  using (EntitiesModel dbContext = new EntitiesModel())
  {
    int dealid = Global.GetInt32(parameters["dealID"].Value.ToString());
    int version = Global.GetInt32(parameters["version"].Value.ToString());
    bool amended = Global.GetBool(parameters["amended"].Value.ToString());
    bool postContract = Global.GetBool(parameters["postContract"].Value.ToString());
    bool staging = Global.GetBool(parameters["staging"].Value.ToString());
    bool commOption = Global.GetBool(parameters["commOption"].Value.ToString());
  
    IEnumerable<rsDealsDealerOpt> d = dbContext.GetDealsDealerOptions(dealid, version, postContract, staging, amended, commOption);
  
    crosstab.DataSource = d;
  }

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
richard
Top achievements
Rank 1
answered on 06 Aug 2013, 12:01 PM
same exact error after making the change you suggested.
0
Peter
Telerik team
answered on 06 Aug 2013, 12:42 PM
Hi Richard,

Looking closely to the provided code snippet we have noticed that you use DBContext. Generally in Q2 2013 SP1 we have added support for DBContext to the EntityDataSource component. Generally our recommendation is when possible to use the declarative approach provided by the report designer. Thus our suggestion is to try the EntityDataSource component from Q2 2013 SP1.

However if you decide to keep your event handling approach our suggestion is to check the GetDealsDealerOptions method because it is the most probable origin of the error.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
richard
Top achievements
Rank 1
answered on 06 Aug 2013, 12:50 PM
I have tried a couple of different ways to get the data with the same error, including the way you just suggested as shown in the images attached. I used the wizard to create the datasource. It works great on my development PC but when moving to the web server i get the errors shown above no matter which data source I use.

i guess I should say i am using version 2013.1.418.2 of OpenAccess
0
Squall
Top achievements
Rank 1
answered on 06 Aug 2013, 12:54 PM
Check the connection string and if the server have the necessary permissions.

Another thing you can do is to test with a simple control like grid to check if the data is retrieved correctly or more information bubbles for the error.

SN
0
richard
Top achievements
Rank 1
answered on 06 Aug 2013, 01:16 PM
the connection string is correct as I get other data on the page using needdatasource into textboxes.
0
richard
Top achievements
Rank 1
answered on 06 Aug 2013, 08:12 PM
well i upgraded to 2013 Q2 and all seems well now.
Tags
General Discussions
Asked by
richard
Top achievements
Rank 1
Answers by
Peter
Telerik team
richard
Top achievements
Rank 1
Squall
Top achievements
Rank 1
Share this question
or