Hi,
I am trying to create a grid like this
.Read(read => read.Action(nameof(RcaDatastructureController.Editing_ReadRcas),
"RcaDatastructure"
,
new
{ key = Model.Product.ProductKey })))*@
@(Html.Kendo().Grid<DashboardRcaRecord>()
.Name(
"grid"
)
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Search();
})
.Columns(columns =>
{
columns.Bound(p => p.JiraLink).Title(
"RCA link"
)
.ClientTemplate($
"<a href=\"#: data.JiraLink#\" target=\"_blank\">#: data.Summary #</a>"
)
.Width(100);
columns.Bound(p => p.PCA).Width(200);
columns.Bound(p => p.QbStatus).Width(100);
columns.Bound(p => p.DataStructureLink).Width(100);
columns.Bound(p => p.FixStatus).Width(100);
columns.Bound(p => p.NumberOfCRsToResolve).Title(
"No of Change Requests"
)
.ClientHeaderTemplate(
"No of<br/>Customer<br/>Defects"
).Width(50);
columns.Bound(p => p.NumberOfE2EsToResolve).Title(
"No of End-to-ends"
)
.ClientHeaderTemplate(
"No of<br/>End-to-ends"
).Width(50);
columns.Bound(p => p.NumberOfMTsToResolve).Title(
"No of Monitor Tasks"
)
.ClientHeaderTemplate(
"No of<br/>Monitor<br/>Tasks"
).Width(50);
columns.Bound(p => p.NumberOfSaasIncsToResolve).Title(
"No of Saas Incidents"
)
.ClientHeaderTemplate(
"No of<br/>Saas<br/>Incidents"
).Width(50);
columns.Bound(p => p.NumberOfDefectsToResolve).Title(
"No of Defects"
)
.ClientHeaderTemplate(
"No of<br/>Defects"
).Width(50);
columns.Bound(p => p.NumberOfCustomerDefectsToResolve).Title(
"No of Customer Defects"
)
.ClientHeaderTemplate(
"No of<br/>Customer<br/>Defects"
).Width(50);
columns.Bound(p => p.NumberOfSpecsToResolve).Title(
"No of Specs"
).ClientHeaderTemplate(
"No of<br/>Specs"
).Width(50);
columns.Command(command => { command.Custom(
"Edit"
).Click(
"editRca"
); }).Width(70);
})
.Editable(e=>e.Mode(GridEditMode.InLine))
.Sortable(sortable => { sortable.SortMode(GridSortMode.MultipleColumn); })
.Filterable()
.Pageable(pgbl => pgbl.Refresh(
true
).PageSizes(
true
))
.DataSource(dataSource => dataSource.Ajax()
.Model(model =>
{
model.Id(p => p.JiraKey);
})
.Read(read => read.Action(nameof(RcaDatastructureController.Editing_ReadRcas),
"RcaDatastructure"
,
new
{ key = Model.Product.ProductKey })))
)
<script type=
"text/javascript"
>
function editRca(e) {
e.preventDefault();
var dataItem =
this
.dataItem($(e.currentTarget).closest(
"tr"
));
window.location.href =
"@Url.Action(nameof(RcaDatastructureController.RcaDetails), "
RcaDatastructure
", new { key=Model.Product.ProductKey})&rcaKey="
+dataItem.JiraKey;
}
$(function () {
var addButton = $(
'a.k-button.k-button-icontext.k-grid-add'
);
addButton.unbind(
'click'
);
addButton.click(function () {
window.location.href =
"@Url.Action(nameof(RcaDatastructureController.RcaDetails), "
RcaDatastructure
", new { key=Model.Product.ProductKey})"
;
});
});
</script>
But it fails at runtime with the exception
nvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or
set
AllowSynchronousIO to
true
instead.
Microsoft.AspNetCore.Server.IIS.Core.HttpResponseStream.Write(
byte
[] buffer,
int
offset,
int
count)
Microsoft.AspNetCore.Server.IIS.Core.WrappingStream.Write(
byte
[] buffer,
int
offset,
int
count)
Microsoft.AspNetCore.WebUtilities.HttpResponseStreamWriter.FlushInternal(
bool
flushEncoder)
Microsoft.AspNetCore.WebUtilities.HttpResponseStreamWriter.Dispose(
bool
disposing)
System.IO.TextWriter.Dispose()
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext,
string
contentType, Nullable<
int
> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData,
string
contentType, Nullable<
int
> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|21_0(ResourceInvoker invoker, IActionResult result)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0<TFilter, TFilterAsync>(ResourceInvoker invoker, Task lastTask, State next, Scope scope,
object
state,
bool
isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(
ref
State next,
ref
Scope scope,
ref
object
state,
ref
bool
isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope,
object
state,
bool
isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(
ref
State next,
ref
Scope scope,
ref
object
state,
ref
bool
isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
However if I comment lines
toolbar.Create();
and
.Editable(e=>e.Mode(GridEditMode.InLine))
makeing grid readonly everything seems to work fine. Any idea why this is happening ?