0

I am working with DevExpress v24.1 in a C# Windows Forms application. I am facing an issue where my DevExpress report only displays a single row of data, even though the assigned data source contains multiple rows.

I suspect the problem is related to the report's structure or data source configuration, but I am unsure of the exact cause.

What could be causing this, and how can I resolve it?

Design of the DevExpress Report is shown here:

enter image description here

Data source sample for my data:

[
  {
    "CardNo": "C001",
    "CarNo": "CAR-101",
    "DriverName": "Ali Hassan",
    "FileNo": "123456",
    "CreatedDate": "2025-11-22T04:57:24.137",
    "AmountViolations": 1000.00
  },
  {
    "CardNo": "C002",
    "CarNo": "CAR-102",
    "DriverName": "Mohamed Youssef",
    "FileNo": "123456",
    "CreatedDate": "2025-11-22T04:57:29.183",
    "AmountViolations": 1000.00
  },
  {
    "CardNo": "C003",
    "CarNo": "CAR-103",
    "DriverName": "Ahmed Ibrahim",
    "FileNo": "123456",
    "CreatedDate": "2025-11-22T04:57:31.36",
    "AmountViolations": 1000.00
  }
]

My code:

private async void BtnPrint_Click(object sender, EventArgs e)
{
    var ReportDataSource = await GetCarsOrgs();

    XtraReport rptOrgCars = new XtraReport();
    rptOrgCars.LoadLayout($@"{Application.StartupPath}\Reports\rptCarsOrg.repx");
    rptOrgCars.DataSource = ReportDataSource.ToList();
    rptOrgCars.ShowPreviewDialog();
}

public async Task<IEnumerable<CarOrgsReport>> GetCarOrgsReport(string CardNo,string CarNo)
{
    var query = from ca in _uow.repOrgCars.Table
                    join c in _uow.repCars.Table on ca.CardNo equals c.CardNo into carsOrgs
                    from c in carsOrgs.DefaultIfEmpty()
                    where   (CarNo == null || c.CarNo == CarNo) && (CardNo == null || c.CardNo == CardNo)
                    select new CarOrgsReport() { CardNo = ca.CardNo, CarNo = c == null ? string.Empty : c.CarNo, DriverName = c.DriverName, CreatedDate = ca.CreationDate, AmountViolations = ca.AmountViolations, FileNo = ca.FileNo };
    var Result = await Task.Run(() => query.ToList());

    // foreach (var result in Result)
    //    result.Duration = result.SourceActionDate == null || result.TargetActionDate == null ? string.Empty : result.TargetActionDate.Value.Subtract(result.SourceActionDate.Value).ToString(@"dd\:hh\:mm\:ss");

    return Result;
}
New contributor
ahmed barbary is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • Not the source of the problem, but you are a calling .ToList() twice. Either return a Task<List<CarOrgsReport>> or then return the query directly without ToList(). Local variables and parameters should have camelCase. Commented Nov 25 at 17:16
  • my issue not on data source my issue how to display rows on dev express report Commented Nov 25 at 17:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.