Completed
Last Updated: 10 Nov 2020 10:04 by ADMIN
Release 2.19.0
Jan Hindrik
Created on: 24 Sep 2020 15:12
Category: Grid
Type: Bug Report
4
FooterTemplate throws when grid Data is null

Sample reproducible with workaround (to initialize the data source so it is not null) is below

Sample error and stack trace

ArgumentNullException: Value cannot be null. (Parameter 'source')


System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
System.Linq.Enumerable.ToList<TSource>(IEnumerable<TSource> source)
Telerik.Blazor.Components.TelerikGrid<TItem>.SetAggregateResults(IEnumerable<AggregateResult> results)
Telerik.Blazor.Components.Common.DataBoundComponent<TItem>.AggregateData()

 

<TelerikGrid Data=@GridData Pageable="true" Height="300px">
    <GridColumns>
        <GridColumn Field="@(nameof(Employee.EmployeeId))">
            <FooterTemplate>
                some footer
            </FooterTemplate>
        </GridColumn>
        <GridColumn Field=@nameof(Employee.Salary) Title="Salary">
        </GridColumn>
        <GridColumn Field=@nameof(Employee.Name)>
        </GridColumn>
    </GridColumns>
</TelerikGrid>

@code {
    public List<Employee> GridData { get; set; } // = new List<Employee>(); // workaround

    public class Employee
    {
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public decimal Salary { get; set; }
    }
}

 

0 comments