Having a problem with context when loading reports dynamically

2 posts, 0 answers
  1. Joseph
    Joseph avatar
    2 posts
    Member since:
    Mar 2012

    Posted 26 Mar 2012 Link to this post

    OK, the basic error message is this: An error has occurred while processing Report 'myReport': The expression contains object 'myField' that is not defined in the current context. 

    I've followed the instructions here: http://www.youtube.com/watch?v=t-iA05KpDFM  for adding a partial view to MVC to allow a report viewer, and it works as long as I use a statically defined report.

    However, if I go in to the OnLoad method and try to change the report to something else, it throws the above error.

    Here is my sample code:

    protected override void OnLoad(EventArgs e)
        ReportViewer1.Report = ViewBag.ReportSource;

    Note the use of the ViewBag to provide access to the new report. This seems to work, except that the new report isn't properly linking to its fields.

    Thanks for your timely response!
  2. Peter
    Peter avatar
    1645 posts

    Posted 29 Mar 2012 Link to this post

    Hi Joseph,

    As you have presumed there is a problem with the reports data binding. Thus we will need more information on the datasource component you utilize and how you set the data item's datasource property. Additionally we will appreciate if you open a support thread and send us the problematic report definition to review and debug on our end.

    Kind regards,
    the Telerik team
    NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
Back to Top