Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't the Visual Studio Report Data screen showing all the available Datasets?

In the below example I have a number of public classes that are defined in a namespace. These are going to be instantiated, bound to ReportDataSets and handed off to my ReportViewer control to generate a report from my report definition files. When I try to access these classes in the Report Data window of the report designer for my .RDLC files, however, it only shows a few of the classes I've defined. What's going on, where are all the rest?

namespace Namespace1
{
    public class Class1
    {
        public string String1 { get; set; }
    }

    public class Class2
    {
        public string String1 { get; set; }
    }
}

Note: If you try to add the Class1 definition to the report page that requires Class2's data and then bind Class2 to the ReportDataSet before the report is generated, an exception will be thrown.

like image 546
Brandon Arnold Avatar asked Jan 20 '13 23:01

Brandon Arnold


People also ask

How do I view datasets in Visual Studio?

Click the dataset node in Solution Explorer to bring the DataSet Designer into focus. Click the Data Sources tab in the left margin of Visual Studio, or type data sources in the search box.

How do I enable report data in Visual Studio?

In Design view, on the View menu, select Report Data, or use CTRL+ALT+D.

How do I get data source in Visual Studio?

In Solution Explorer (on the right of the Microsoft Visual Studio window), right-click Data Source Views, and then click New Data Source View. On the Welcome to the Data Source View Wizard page, click Next. The Select a Data Source page appears.

How do I find the DataSet in Rdlc?

Go to Design view, Select Smart tag. Click Choose Report Dropdown, Select RDLC report (StudentReport). Click Choose Data Source and select <New data Source>. Select Object and Give DataSource Name.


1 Answers

When there are a number of classes with the same schema (all properties and their datatypes are the same), only the one that's first alphabetically will show up. But both will show up in the below example, because they do not have the same name for all properties (in this case, the one string).

namespace Namespace1
{
    public class Class1
    {
        public string String1 { get; set; }
    }

    public class Class2
    {
        public string String2 { get; set; }
    }
}
like image 59
Brandon Arnold Avatar answered Oct 20 '22 23:10

Brandon Arnold