Declined
Last Updated: 01 Oct 2019 10:04 by ADMIN
Neil Jackson
Created on: 09 Sep 2019 09:49
Category: Grid
Type: Bug Report
0
grid

Hi,

I cant see what it is that's causing this error. evertime i run my app, i get the follwoing error below:

An unhandled exception occurred while processing the request.

InvalidOperationException: Object of type 'Telerik.Blazor.Components.Grid.TelerikGrid`1[[BlazorApp1.Core.DTO.AuditEventTypeDTO, BlazorApp1.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not have a property matching the name 'ChildContent'.

Microsoft.AspNetCore.Components.Reflection.ComponentProperties.ThrowForUnknownIncomingParameterName(Type targetType, string parameterName

 

My Code:

@page "/Table"

@inject IPurchaseOrderRepository purchaseOrderRepository
@using Telerik.Blazor.Components.Grid
    <h3>Table</h3>

<TelerikGrid Data=@auditEventTypeDTOs>
    <TelerikGridColumn Field="AuditEventName">

    </TelerikGridColumn>
</TelerikGrid>


@code{



    public IEnumerable<AuditEventTypeDTO> auditEventTypeDTOs { get; set; }

    protected override async Task OnInitializedAsync()
    {
        auditEventTypeDTOs = await purchaseOrderRepository.GetAllAuditEventTypes();
    }

}

 

 

The IEnumerable object 'auditEventTypeDTOs' is getting the data from the repository and i've made sure that i don't have any component with the same name within Telerik.blazor namespace.

 

Do let me know if you need me me to supply more information.

 

many thanks in advance

 

George.

4 comments
ADMIN
Marin Bratanov
Posted on: 01 Oct 2019 10:04

It has been a few weeks and we have not had more information about this, and we have not had other reports of this issue. Thus, I am going to assume it was an issue in the application code that is now fixed. If not, please provide relevant details for reproducing it with the latest version and I will look into it. Until then, I am closing this item.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
ADMIN
Marin Bratanov
Posted on: 09 Sep 2019 12:08

Hello Neil,

Can you send me a small, runnable sample that showcases the problem? This is not a known issue in the grid and referencing models from outside the page model works fine, I use that "technique" to provide runnable samples only.

On a side note, can you confirm that you have:

  • Telerik UI for Blazor 1.7.0
  • .NET Core 3 Preview 9
  • Visual Studio 2019 Preview

All these three points are important, as earlier version don't work anymore.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Neil Jackson
Posted on: 09 Sep 2019 10:28

Hi Marin,

 

Thanks for getting back to me.

 

I made the changes you suggested but unfortunately i'm still getting the same error.

 

I even went as far replacing the my view with your sample code and it still didn't work.

 

The DTO i'm referencing is in another layer withing the solution. when i copy the DTO into the razor page like you've done in your sample code, it works fine. But it seems it has a problem with referencing this object or any other object for that matter that is not directly in the razor page. 

i tested it by removing the telerik grid reference and looped over my list displaying the content into a div whilst still referencing the DTO from another layer and no problem, but as soon as i include the grid it breaks.

ADMIN
Marin Bratanov
Posted on: 09 Sep 2019 10:04

Hi George,

The grid columns need to be in their own dedicated tag, and it is missing from the provided markup, it needs to be something like this:

 

@using Telerik.Blazor.Components.Grid
<h3>Table</h3>

<TelerikGrid Data=@auditEventTypeDTOs>
    <TelerikGridColumns>
        <TelerikGridColumn Field="AuditEventName">
        </TelerikGridColumn>
    </TelerikGridColumns>
</TelerikGrid>


@code{
    public IEnumerable<AuditEventTypeDTO> auditEventTypeDTOs { get; set; }

    protected override async Task OnInitializedAsync()
    {
        auditEventTypeDTOs = Enumerable.Range(1, 5).Select(x => new AuditEventTypeDTO { AuditEventName = $"event {x}" });
        //auditEventTypeDTOs = await purchaseOrderRepository.GetAllAuditEventTypes();
    }

    public class AuditEventTypeDTO
    {
        public string AuditEventName { get; set; }
    }
}

You can find more examples on declaring the grid, its correct structure and using its features in the documentation: https://docs.telerik.com/blazor-ui/components/grid/overview.

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor