Articles in this section
Category / Section

How to create RDLC report using Business Object Data Source in Syncfusion ASP.NET Core Report Viewer

2 mins read

Syncfusion ReportViewer supports loading RDLC reports using the Business Object Data Source. You can create the RDLC reports using any one of the following options to preview in the ReportViewer:

  • Microsoft Visual Studio Report Wizard.
  • Syncfusion Report Designer.

 

Syncfusion Report Designer

Click here to create an RDLC report in the Report Designer through the Wizard.

 

Microsoft Visual Studio Report Wizard

To create an RDLC report using Microsoft Visual C#, follow these steps:

  1. Open Microsoft Visual studio in the New Project dialog box.
  2. Choose Visual C# and select the template based on required project type like Console application, WPF, ASP.Net MVC.
  3. Give name for the project and click OK.
  4. In the Project menu, select Add New Item and choose Class. Then, name it as SalesPersons and click Add.
  5. Replace the default code for SalesPersons.cs with the following code.

 

#region SalesPersons
 
public class SalesPersons
{
    public string Name { get; set; }
    public double QS1 { get; set; }
    public double QS2 { get; set; }
    public double QS3 { get; set; }
    public double QS4 { get; set; }
    public double Total { get; set; }
    public int Year { get; set; }
 
    public static IList GetTopSalesPerson()
    {
        List<SalesPersons> SalesPersonCollection = new List<SalesPersons>();
        SalesPersons salesPerson = null;
        salesPerson = new SalesPersons()
        {
            Name = "Carol Elliott",
            QS3 = 656287.9884,
            QS4 = 1006810.7219,
            Total = 1663098.7103,
            Year = 2001
        };
        SalesPersonCollection.Add(salesPerson);
        salesPerson = new SalesPersons()
        {
            Name = "Linda Ecoffey",
            QS3 = 547589.0181,
            QS4 = 951811.3768,
            Total = 1499400.3949,
            Year = 2002
        };
        SalesPersonCollection.Add(salesPerson);
        salesPerson = new SalesPersons()
        {
            Name = "Shelley Dyck",
            QS3 = 551800.5660,
            QS4 = 823059.5628,
            Total = 1374860.1288,
            Year = 2001
        };
        SalesPersonCollection.Add(salesPerson);
 
        return SalesPersonCollection;
    }
}
 
#endregion
 
#region Stores
 
public class Stores
{
    public string Name { get; set; }
    public double QS1 { get; set; }
    public double QS2 { get; set; }
    public double QS3 { get; set; }
    public double QS4 { get; set; }
    public double Total { get; set; }
    public int year { get; set; }
 
    public static IList GetTopStores()
    {
        List<Stores> StoreCollection = new List<Stores>();
        Stores store = null;
        store = new Stores()
        {
            Name = "Bicycle Company",
            QS3 = 656287.9884,
            QS4 = 1006810.7219,
            Total = 1663098.7103,
            year = 2001
        };
        StoreCollection.Add(store);
        store = new Stores()
        {
            Name = "Activity Center",
            QS3 = 656287.9884,
            QS4 = 1006810.7219,
            Total = 1663098.7103,
            year = 2002
        };
        StoreCollection.Add(store);
        store = new Stores()
        {
            Name = "Bike Shop",
            QS3 = 656287.9884,
            QS4 = 1006810.7219,
            Total = 1663098.7103,
            year = 2001
        };
        StoreCollection.Add(store);
 
        return StoreCollection;
    }
}
 
#endregion
 
#region Products:
 
public class Products
{
    public string Name { get; set; }
    public double QS1 { get; set; }
    public double QS2 { get; set; }
    public double QS3 { get; set; }
    public double QS4 { get; set; }
    public double Total { get; set; }
    public int Year { get; set; }
 
    public static IList GetTopProducts()
    {
        List<Products> ProductCollection = new List<Products>();
        Products product = null;
        product = new Products()
        {
            Name = "AWC Logo Cap",
            QS3 = 2104165.3554,
            QS4 = 3308323.5938,
            Total = 5412488.9492,
            Year = 2001
        };
        ProductCollection.Add(product);
        product = new Products()
        {
            Name = "S-100 Helmet, B",
            QS3 = 1988382.4844,
            QS4 = 3279281.6611,
            Total = 5267664.1455,
            Year = 2001
        };
        ProductCollection.Add(product);
        product = new Products()
        {
            Name = "L-Sleeve Jrsey",
            QS3 = 1974839.7878,
            QS4 = 3282139.2608,
            Total = 5256979.0486,
            Year = 2001
        };
        ProductCollection.Add(product);
 
        return ProductCollection;
    }
}
 
#endregion
  1. In the Project menu, select Build Solution. This creates an assembly for the object, which will be used as a data source for the report.
  2. Right-click the project and go to the Add New Item dialog. Select Report Wizard, and name it as Sales Dashboard.rdlc for the report, and then click Add. This shows the Report Wizard dialog.
  3. In the Choose a Data Source Type page, select Object and click Next.
  4. In the Select the Data Objects page, expand the class hierarchy until you see Products in the list. Select Products and click Finish.

 

  1. In the Dataset Properties page, check the Available datasets box and verify whether the Product is selected and click Next.
  2. In the Arrange Fields page, drag Name, QS1, QS2, QS3, QS4 from the available fields to the Values box. Click Next twice, and then click Finish. This will create an .rdlc file and open it in the designer page and display the created Tablix report item.
  3. Save the Sales Dashboard.rdlc file. Now, the created reports can be used to preview in the Syncfusion reporting controls.

 

References to load created RDLC report in ReportViewer

Click here to create a simple application and load the RDLC report in the ASP.NET Core ReportViewer.

 

Note: You can create a data source in the same application or in the separate application to use it as assembly for report data source.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied