We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create RDLC report using Business Object Data Source

Platform: ASP.NET Web Forms |
Control: ReportViewer

The following shows the procedure to create RDLC report using Microsoft Visual C#.

  1. Open Microsoft Visual studio, in New Project dialog box, choose Visual C#, and then choose the WPF Application template and give project name, and click OK.
    Note:

    Choose the New Project template based on your development platform. It can be a WPF, ASP.NET and Windows Forms.

  1. From the Project menu, select Add New Item, choose Class, name as SalesPersons and click Add.
  2. Replace the default code for SalesPersons.cs with the following code:

            C#

#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. From the Project menu, select Build Solution. This creates an assembly for the object, which you will later use as a data source for the report.
  2. Right click on the project and go to Add New Item dialog, select Report Wizard and name as Sales Dashboard.rdlc for the report and 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.

Select Products in Data Source Configuration Wizard

  1. In the Dataset Properties page, check the Available datasets box, verify that Product is selected  and click Next.
  2. In the Arrange Fields page drag Name, QS1, QS2, QS3, QS4 from available fields to the Values box. Click Next twice, then click Finish. This creates the .rdlc file and opens it in designer page and displays the tablix created.
  3. Save the .rdlc file.

 

Also the RDLC report can be created using Syncfusion ReportDesigner, refer to the online documentation from the below location.

https://help.syncfusion.com/wpf/reportdesigner/create-rdlc-reports-through-wizard

 

The created reports can be used in the Syncfusion reporting controls.

 

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile