We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Following documentation steps in Getting Started (Grid) get FileNotFoundException

"Syncfusion.EJ2.AspNet.Core.RazorComponents" Version="17.1.0.47-beta"
VS Preview 16.1.0 Preview 3.0
Server-Side Blazor

changing <table class="table">....  in FetchData.razor with 

<Ejs-grid id="Grid" DataSource="@forecasts">
    <GridColumns>
        <GridColumn Field="Date" HeaderText="Date"></GridColumn>
        <GridColumn Field="TemperatureC" HeaderText="Temp. (C)"></GridColumn>
        <GridColumn Field="TemperatureF" HeaderText="Temp. (F)"></GridColumn>
        <GridColumn Field="Summary" HeaderText="Summary"></GridColumn>
    </GridColumns>
</Ejs-grid>

will not work. 
FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.



6 Replies

UH Uwe Hein May 18, 2019 07:07 AM UTC

Hi Daniel,

   just add Newtonsoft.Json with the Package Manager and it will work.

      regards

          Uwe


DA Daniel May 18, 2019 06:40 PM UTC

Hi Uwe,

I try adding this :
"Newtonsoft.Json 12.0.2" or "Microsoft.AspNetCore.Mvc.NewtonsoftJson  3.0.0-preview5-19227-01"

but now i get this error:
NullReferenceException: Object reference not set to an instance of an object.
Syncfusion.EJ2.RazorComponents.Grids.GridColumns.OnInit()

I have attached the project

Thanks

Attachment: WebApplication1_359cac46.zip


UH Uwe Hein May 20, 2019 07:15 AM UTC

Hi Daniel,

  thanks for your code. I did just a quick and dirty hack <G>

  change your FetchData.razor to the code at the end.

Download the blazor samples at

https://github.com/syncfusion/ej2-aspnet-core-blazor-samples

and check the grid samples...

    regards

      Uwe



@page "/fetchdata"

@using WebApplication1.Data

@using Syncfusion.EJ2.RazorComponents
@using Syncfusion.EJ2.RazorComponents.Grids

@inject WeatherForecastService ForecastService

<h1>Weather forecast</h1>

<p>This component demonstrates fetching data from a service.</p>

@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<EjsGrid id="Grid" ref="defaultGrid" DataSource="@gridData" AllowPaging="true">
<GridPageSettings PageCount="5"></GridPageSettings>
<GridColumns>
<GridColumn Field="Date" HeaderText="Date"></GridColumn>
<GridColumn Field="TemperatureC" HeaderText="Temp. (C)"></GridColumn>
<GridColumn Field="TemperatureF" HeaderText="Temp. (F)"></GridColumn>
<GridColumn Field="Summary" HeaderText="Summary"></GridColumn>
</GridColumns>
</EjsGrid>
}

@functions {

EjsGrid defaultGrid;

public object gridData { get; set; }

WeatherForecast[] forecasts { get; set; }

protected override async Task OnInitAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}

protected override void OnAfterRender()
{
this.defaultGrid.DataSource = gridData = forecasts;
}
}




PS Pavithra Subramaniyam Syncfusion Team May 20, 2019 11:43 AM UTC

Hi Daniel, 
  
Thanks for your sample code. 
  
We have checked the attached sample and we suggest you to use the grid tag(<EjsGrid >), which is the tag we have used for Grid rendering and we suggest you to import the Syncfusion.EJ2.RazorComponents as like below. Please refer the below code snippet, sample link and demo link. 
  
[fetchData.razor] 
@page "/fetchdata" 
@using WebApplication1.Data 
@inject WeatherForecastService ForecastService 
@using Syncfusion.EJ2.RazorComponents.Grids 
@using Newtonsoft.Json; 
  
<h1>Weather forecast</h1> 
  
<p>This component demonstrates fetching data from a service.</p> 
  
@if (forecasts == null) 
    <p><em>Loading...</em></p> 
else 
    <EjsGrid id="Grid" DataSource="@forecasts"> 
            <GridColumns> 
                <GridColumn Field="Date" HeaderText="Date"></GridColumn> 
                       .   .   .   . 
            </GridColumns> 
        </EjsGrid
  
@functions { 
    WeatherForecast[] forecasts; 
    protected override async Task OnInitAsync() 
    { 
        forecasts = await ForecastService.GetForecastAsync(DateTime.Now); 
    } 
  
  
  
Please get back to us for further assistance. 
  
Regards, 
Pavithra S. 
 



DA Daniel May 20, 2019 07:38 PM UTC

Thanks Uwe and Pavithra,

Is working now

Regards,
Daniel


PS Pavithra Subramaniyam Syncfusion Team May 21, 2019 04:12 AM UTC

Hi Daniel,  

Thanks for your update. 

We are happy to hear that the provided solution is working. 

Please contact us if you need any further assistance. As always, we will be happy to assist you.  

Regards,  
Pavithra S. 


Loader.
Live Chat Icon For mobile
Up arrow icon