In the Visual Studio Telerik Reporting Designer, the Data Explorer pane shows all data sources and their members for drag-and-drop to the designer. We have reports that we are inheriting from a base report, however. In this case, the Data Explorer is showing the data source(s) of the base report (objectDataSource.DataSource = typeof(BaseViewModel)
) rather than the child report (objectDataSource.DataSource = typeof(ChildViewModel)
) that is currently open in the designer. Is there a way to get the Data Explorer to instead show the data sources of the child report?
Here is our relevant code:
public partial class BaseReport
{
private void InitializeComponent()
{
objectDataSource = new Telerik.Reporting.ObjectDataSource();
objectDataSource.DataMember = "GetRecords";
objectDataSource.DataSource = typeof(BaseViewModel);
objectDataSource.Name = "objectDataSource";
DataSource = this.objectDataSource;
}
protected Telerik.Reporting.ObjectDataSource objectDataSource;
}
public class BaseViewModel
{
...
// without this dummy method, an exception is thrown in Data Explorer
public IEnumerable<string> GetRecords()
{
return new List<string>();
}
...
}
public partial class ChildReport : BaseReport
{
public ChildReport()
{
InitializeComponent();
objectDataSource.DataSource = typeof(ChildViewModel);
}
}
public class ChildViewModel
{
...
public IEnumerable<MyRecord> GetRecords()
{
return GetMyRecords();
}
...
}