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:
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;
}
.ToList()twice. Either return aTask<List<CarOrgsReport>>or then return the query directly withoutToList(). Local variables and parameters should have camelCase.