none
Reportviewer 2010 Migration problem RRS feed

  • Question

  • Hi everyone.

    I'm struggling with the migration of Reportviewer 9 (vs2008) to Reportviewer 10 (vs2010).

    Here is the problem:

    I changed my Website to a Webproject (web application), and now my reports can't identify the datasources in the project, unless they (datasources/datasets) are on project's root folder.

    Today my report definitions are in the folder 'Reports' and my datasets are in the folder 'Datasets'.

    Considering that in a Website, all datasets are stored on App_Code, should have an equivalent behavior on Webprojects, am i right?

    Anyone knows why the reports are unable to identify the datasets? or how can i develop reports on vs2010 without have to create datasets on root folder?

    Thanks.

    Fabio

     

    Wednesday, October 6, 2010 6:27 PM

All replies

  • This is indeed a functional quirk of the viewer control. There was a lengthy discussion on this a while back: http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/d0f33974-af33-421f-9780-78b908850b4d.

    Visual Studio automatically renames the namespace of your data source depending on where you place the data source in the project tree. This is pretty clear if you have your data source's .design.cs file open, then try to drag the XSD into a different folder, and then watch the namespaces change names in the .design.cs file.

    Short answer:, you CAN have your data sources in a directory other than the root project directory. You just need to make sure that the namespace changes to your TableAdapter in the .design.cs file is reflected in the ObjectDataSource.TypeName property in your ASPX file, since the ReportViewer control won't do this for you automatically unless the XSD is in the root project directory.

    The TypeName property should contain the full type name of the data source as defined by your XSD, including the namespace. If you created your data source using the Data Source Configuration Wizard, by default this will look like:

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
      SelectMethod="<TableAdapter's_Select_method_name>"
     
    TypeName="<project_name>.<XSD_name>.<TableAdapter_name>">
    </asp:ObjectDataSource>

    You should be able to find all the info above from your XSD and XSD's design.cs file. 


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Thursday, October 7, 2010 3:27 PM
    Moderator
  • Hi Cephalin, thanks for your reply.

    Unfortunately, there are some different aspects on my implementation.

    I'm using the XSD just to define the model for my reports, so i'm not creating TableAdapters for them.

    Likewise, I'm not using ObjectDataSources.

    I have my ReportViewer control on a masterpage, and the child pages are setting all properties necessary to run it: ReportPath, DataSources, etc. All programmatically.

    Another thing: as I'm using a Web Application Project, I had setted the Default Namespace for something like this: com.company.web, so VS is generating the dataset namespace on Designer.cs file like com.company.web.DataSets.

    Even when I change the generated namespace on Designer.cs file, I'm unable to set an existing dataset to my report.

    Any ideas?

    Monday, October 11, 2010 6:30 PM
  • So sounds like you're just trying to get your XSD datasets to be visible in report designer?

    Unfortunately, in order for them to be visible in report designer, you must put them in the root folder. The is true for VS2010. However, once you finish designing your report, you should be able to put them wherever you like. I.e. whether the report runs successfully doesn't depend on whether the VS report designer can see the XSDs and import their, but for you to successfully import the datasets into report designer, you need to put the XSDs in the root folder so report designer can see them. Does that make sense?


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Monday, October 11, 2010 7:53 PM
    Moderator
  • Exactly. I usually use the XSD to let the report knows the data it has to use...

    I understand this concept, but i guess it is really bad for maintenance, right?

    Well, I'll try other implementations before have to leave the XSDs on root folder. If I succeed, I'll post my solution here.

    Thank you very much, Cephalin.

    Monday, October 11, 2010 9:16 PM