Error: One or more errors occurred. (Root component type 'BlazorCRUD.Components.Pages.Home' could not be found in the assembly 'BlazorCRUD'

1 Answer 1757 Views
Grid
Muhamad
Top achievements
Rank 1
Muhamad asked on 02 Feb 2024, 03:58 AM
I got this error in browser
Error: One or more errors occurred. (Root component type 'BlazorCRUD.Components.Pages.Home' could not be found in the assembly 'BlazorCRUD'.)
    at Jn (marshal-to-js.ts:349:18)
    at Ul (marshal-to-js.ts:306:28)
    at 00b1ee2e:0x1facb
    at 00b1ee2e:0x1bf8c
    at 00b1ee2e:0xf173
    at 00b1ee2e:0x1e7e5
    at 00b1ee2e:0x1efdb
    at 00b1ee2e:0xcfed
    at 00b1ee2e:0x44108
    at e.<computed> (cwraps.ts:338:24)

in my code home.razor
@page "/"
@attribute [StreamRendering]
@inject IDateServices DateServices
@rendermode InteractiveAuto

<PageTitle>Home</PageTitle>

<h1>Hello, world!</h1>

Welcome to your new app.

<br />

<TelerikButton OnClick="@SayHelloHandler" ThemeColor="primary">Say Hello</TelerikButton>

<br />

@helloString

<br />

@if (dates.Count == 0)
{
    <span>Loading.....</span>
}
else if (dates.Count != 0)
{
        <TelerikGrid Data="@dates"
                     Pageable="true"
                     Sortable="true"
                     FilterMode="@GridFilterMode.FilterRow">
            <GridColumns>
                <GridColumn Field="BOOKING_DATE" Title="Booking Date" />
            </GridColumns>
        </TelerikGrid>
}
else
{
    <span>No Data</span>
}

<Notes PageInteractivity="static" AppInteractivity="static" />

@code {
    MarkupString helloString;

    void SayHelloHandler()
    {
        string msg = string.Format("Hello from <strong>Telerik Blazor</strong> at {0}.<br /> Now you can use C# to write front-end!", DateTime.Now);
        helloString = new MarkupString(msg);
    }
    List<TABELDAYS31TEST> dates = new List<TABELDAYS31TEST>();
    private List<Product> GridData { get; set; }


    protected override async Task OnInitializedAsync()
    {
        await Task.Delay(1000);

        GridData = new List<Product>();
        dates = await DateServices.GetAllDate();

        var rnd = new Random();

        for (int i = 1; i <= 30; i++)
        {
            GridData.Add(new Product
            {
                Id = i,
                Name = "Product name " + i,
                Price = (decimal)(rnd.Next(1, 50) * 3.14),
                Released = DateTime.Now.AddDays(-rnd.Next(1, 365)).AddYears(-rnd.Next(1, 10)).Date,
                Discontinued = i % 5 == 0
            });

        }
    }

    // protected override void OnInitialized()
    // {
    //     GridData = new List<Product>();

    //     var rnd = new Random();

    //     for (int i = 1; i <= 30; i++)
    //     {
    //         GridData.Add(new Product
    //             {
    //                 Id = i,
    //                 Name = "Product name " + i,
    //                 Price = (decimal)(rnd.Next(1, 50) * 3.14),
    //                 Released = DateTime.Now.AddDays(-rnd.Next(1, 365)).AddYears(-rnd.Next(1, 10)).Date,
    //                 Discontinued = i % 5 == 0
    //             });

    //     }

    //     base.OnInitialized();
    // }

    public class Product
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public decimal Price { get; set; }
        public DateTime Released { get; set; }
        public bool Discontinued { get; set; }
    }
}

can someone help for this error, thanks.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Feb 2024, 05:47 PM

Hello Muhamad,

This error means that there is an interactive component (Home.razor) in the server project of an app, which has render mode WebAssembly or Auto.

Interactive components belong to the Client project in your case.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Tags
Grid
Asked by
Muhamad
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or