Syncfusion Blazor Grid not loading correctly

Hello,

Im trying to create a project using Syncfusion.Blazror.Grid NuGet package (20.3.0.49). I have created a simple table that should be displayed in gridcolumns. 

@page "/"

@using TheContactList.Shared

@using Syncfusion.Blazor.Grids

<SfGrid DataSource="@Contacts">

    <GridColumns>

        <GridColumn Field=@nameof(Contact.ContactId) HeaderText="ID"></GridColumn>

        <GridColumn Field=@nameof(Contact.FirstName) HeaderText="Imię"></GridColumn>

        <GridColumn Field=@nameof(Contact.LastName) HeaderText="Nazwisko"></GridColumn>

        <GridColumn Field=@nameof(Contact.Email) HeaderText="Email"></GridColumn>

    </GridColumns>

</SfGrid>




@code{

    public List<Contact> Contacts { get; set; }


    protected override void OnInitialized()

    {

        Contacts = LoadData();

    }


    private List<Contact> LoadData()

    {

        //Dodaje paru pracowników w ramach testu

        Contact c1 = new Contact

            {

                ContactId = 1,

                FirstName = "Anna",

                LastName = "Nowak",

                Email = "[email protected]",

                Password = "sfsfgg",

                DateOfBirth = new DateTime(2003, 07, 10),

                CategoryType = 1, 

                PhotoPath = "images/anna.png",

                PhoneNumber = 546645123




            };

        Contact c2 = new Contact

            {

                ContactId = 2,

                FirstName = "Adrian",

                LastName = "Rutkowski",

                Email = "[email protected]",

                Password="wefwef",

                DateOfBirth = new DateTime(2001, 10, 18),

                CategoryType = 2,

                PhotoPath = "images/adi.png",

                PhoneNumber = 32245671


            };

        Contact c3 = new Contact

            {

                ContactId = 3,

                FirstName = "Mikołaj",

                LastName = "Cegła",

                Email = "[email protected]",

                DateOfBirth = new DateTime(2003, 07, 10),

                CategoryType = 1,

                PhotoPath = "images/mickey.png",

                PhoneNumber = 566788111


            };

        return new List<Contact> { c1, c2, c3 };

    }

}

However when i fire up the project it displays like this:



As you can see the GridColumn has failed to load. I already tried installing the full Sf Blazor package and added

<link rel='nofollow' href="_content/Syncfusion.Blazor.Themes/bootstrap4.css" rel="stylesheet" /> to wwwroot/index.html. What else can i do to solve this problem?



1 Reply

PS Prathap Senthil Syncfusion Team October 14, 2022 03:30 PM UTC

Hi Szymon,


Greetings from Syncfusion support.

Based on your update, we assume that the theme and scripts are not referred properly that's why you are facing an error. So, kindly refer the attached code snippet and UG documentation for your reference. Before that Kindly make ensure to include script and themes in your project.


<head>

    <meta charset="utf-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

    <title>BlazorApp2</title>

    <base rel='nofollow' href="/" />

    <link rel='nofollow' href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />

    <link rel='nofollow' href="css/app.css" rel="stylesheet" />

    <link rel='nofollow' href="BlazorApp2.styles.css" rel="stylesheet" />

    <link rel='nofollow' href=https://cdn.syncfusion.com/blazor/20.3.49/styles/bootstrap5.css rel="stylesheet" />

    <script src=https://cdn.syncfusion.com/blazor/20.3.49/syncfusion-blazor.min.js type="text/javascript"></script>

</head>


If you are referencing themes or scripts from CDN, can you please ensure to change the version of reference.

https://blazor.syncfusion.com/documentation/appearance/themes#cdn-reference

https://blazor.syncfusion.com/documentation/common/adding-script-references#cdn-reference



Regards,

Prathap S


Attachment: BlazorApp2_4fb0efa5.zip

Loader.
Up arrow icon