在将blazor项目从.net Preview 7升级到.net core 3.0.100版本后,我在sycfusion网格控件中遇到了错误,我更新了所有最新的软件包。 https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-9/
`blazor.server.js:8 Uncaught (in promise) Error: System.ArgumentException: The call to 'UpdateTemplate' expects '5' parameters, but received '4'. at
Microsoft.JSInterop.Infrastructure.DotNetDispatcher.ParseArguments(JSRuntime jsRuntime, String methodIdentifier, String arguments, Type[] parameterTypes)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
at Object.endInvokeDotNetFromJS (blazor.server.js:8)
at e.<anonymous> (blazor.server.js:8)
at blazor.server.js:1
at Array.forEach (<anonymous>)
at e.invokeClientMethod (blazor.server.js:1)
at e.processIncomingData (blazor.server.js:1)
at e.connection.onreceive (blazor.server.js:1)
at WebSocket.i.onmessage (blazor.server.js:1)
endInvokeDotNetFromJS @ blazor.server.js:8
(anonymous) @ blazor.server.js:8
(anonymous) @ blazor.server.js:1
e.invokeClientMethod @ blazor.server.js:1
e.processIncomingData @ blazor.server.js:1
connection.onreceive @ blazor.server.js:1
i.onmessage @ blazor.server.js:1
<EjsGrid ID="gdProjects" @ref="gdProjects" ModelType="@model" DataSource="@filteredProjects" AllowReordering="true" AllowFiltering="true" AllowPaging="true" AllowMultiSorting="false" AllowSorting="true" AllowExcelExport="true" AllowPdfExport="true" Toolbar="@(new List<string>() { "Search" })">
<GridFilterSettings Type="@Syncfusion.EJ2.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
<GridPageSettings PageCount="10" PageSizes="true"></GridPageSettings>
<GridColumns>
<GridTemplates>
<RowTemplate>
@{
var project = (context as ProjectTable);
<td class="data-cell pointer" @onclick="(()=>OnProjectClick(project.ProjectId))">
@project.ProjectName
</td>
<td class="data-cell pointer" @onclick="(()=>OnClientClick(project.ClientId))">
@project.ClientName
</td>
<td class="data-cell">
@project.Status
</td>
<td class="data-cell">
@project.NextStep
</td>
<td class="data-cell">
@project.DueDate
</td>
}
</RowTemplate>
</GridTemplates>
<GridColumn Field=@nameof(ProjectTable.ProjectName) HeaderText="Project Name" />
<GridColumn Field=@nameof(ProjectTable.ClientName) HeaderText="Client Name" />
<GridColumn Field=@nameof(ProjectTable.Status) HeaderText="Status" />
<GridColumn Field=@nameof(ProjectTable.NextStep) HeaderText="Next Step" />
<GridColumn Field=@nameof(ProjectTable.DueDate) HeaderText="Due Date" />
</GridColumns>
</EjsGrid>`
答案 0 :(得分:1)
我猜Nuget(Syncusion.EJ2.Blazor
)和ejs.interop.min.js
文件之间版本不匹配。请确保使用相同版本的脚本文件来解决此错误。
例如,如果您使用的是 Nuget v17.3.17 ,则应从下面的CDN中引用脚本文件。
<script src="https://cdn.syncfusion.com/ej2/17.3.17/dist/ejs.interop.min.js"></script>
参考: https://ej2.syncfusion.com/blazor/documentation/grid/getting-started/