Hello.
I am facing an issue with LoadDataArgs.
I used LoadData approach to fill RadzenDataGrid. It works well. But in one case I get error message Nullable object must have a value. I found out its caused by LoadDataArgs object, which is not set.
To set WHERE parameters to my query, I use RadzenDropdown component with AllowClear set to true.
LoadData method looks like this:
async Task LoadData(LoadDataArgs args)
{
isLoading = true;
await Task.Yield();
var query = dlContext.Dls
.Select(s => new Statistics()
{
GUID = s.Guid,
Import = s.Import,
CreatedBy = s.CreatedBy,
CreatedOn = s.CreatedOn,
StartedOn = s.StartedOn,
CompletedOn = s.CompletedOn,
FileName = s.FileName,
InstantRun = s.InstantRun,
StatusCode = s.StatusCode,
Success = GetCount(s.Guid, (int)ImportStatus.Successful, s.Import, dlContext),
Failed = GetCount(s.Guid, (int)ImportStatus.Failed, s.Import, dlContext),
Totals = GetCount(s.Guid, (int)ImportStatus.Totals, s.Import, dlContext)
}).AsQueryable();
if (importValue != null)
{
query = query.Where(c => c.Import == importValue);
}
if (filenameValue != "")
{
query = query.Where(c => c.FileName.Contains(filenameValue));
}
if (importState != null)
{
var state = Enum.Parse(typeof(ImportStatus), importState);
query = query.Where(c => c.StatusCode == (int)state);
}
if (createdOnFrom != DateTime.MinValue)
{
query = query.Where(c => c.CreatedOn >= createdOnFrom);
}
if (createdOnTo != DateTime.MinValue)
{
query = query.Where(c => c.CreatedOn <= createdOnTo);
}
if (!string.IsNullOrEmpty(args.OrderBy))
{
// Řazení pomocí OrderBy z argumentů, které se berou z gridu
query = query.OrderBy(args.OrderBy);
}
// Nastavení celkového počtu záznamů do proměnné použité v RadzenDataGridu
count = query.Count();
// Provádění stránkování pomocí Skip a Take
records = query.Skip(args.Skip.Value).Take(args.Top.Value).ToList();
isLoading = false;
}
And the code for the DataGrid is here:
Did you already experienced such problem?