This is a migrated thread and some comments may be shown as answers.

ToDataSourceResult Crash! - on Grid filter

1 Answer 361 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Xavier Mingo
Top achievements
Rank 1
Xavier Mingo asked on 08 Mar 2017, 11:10 AM

Hi,

I'm in a trial version to test your Grid component. When it's filter enabled and there are a lot of quick queries it crash (Open connection exception). It happens in async version too:

public IActionResult GetData([DataSourceRequest] DataSourceRequest request)
{
      return Json(this._seasonRepository.Query().ToDataSourceResult(request));
}

Se produjo la excepci├│n System.InvalidOperationException.

  HResult=0x80131509
  Mensaje = ExecuteReader requires an open and available Connection. The connection's current state is open.
  Origen = System.Data.SqlClient
  Seguimiento de la pila:
   at System.Data.SqlClient.SqlConnection.GetOpenTdsConnection(String method)
   at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command)
   at System.Data.SqlClient.SqlCommand.ValidateCommand(Boolean async, String method)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, String executeMethod, IReadOnlyDictionary`2 parameterValues, Boolean closeConnection)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.BufferlessMoveNext(Boolean buffer)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](Func`2 operation, Func`2 verifySucceeded, TState state)
   at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
   at Kendo.Mvc.Extensions.QueryableExtensions.Execute[TModel,TResult](IQueryable source, Func`2 selector)
   at Kendo.Mvc.Extensions.QueryableExtensions.CreateDataSourceResult[TModel,TResult](IQueryable queryable, DataSourceRequest request, ModelStateDictionary modelState, Func`2 selector)
   at Kendo.Mvc.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable queryable, DataSourceRequest request)
   at Oleoshop.Areas.Admin.Controllers.Commerce.Catalog.SeasonsController.GetData(DataSourceRequest request) in

 

This is my Grid razor configuration (very simple to test)

    @(Html.Kendo().Grid<Oleo.Commerce.Catalog.Season>()
                            .Name("grid")
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .ServerOperation(true)
                                .Read(read => read.Action("GetData", "Seasons"))
                            )
                            .Columns(columns =>
                            {
                                columns.Bound(c => c.Id).Width(140).Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
                                columns.Bound(c => c.Name).Width(500).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
                                columns.Bound(c => c.Reference).Width(500).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
                            })
                            .Scrollable(x => x.Height(700))
                            .Groupable()
                            .Sortable()
                            .Pageable(pageable => pageable
                                .Refresh(true)
                                .PageSizes(true)
                                .ButtonCount(5))
                            .Resizable(resize => resize.Columns(true))
                            .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
                    )

Please let me know

Regards

 

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 13 Mar 2017, 09:41 AM
Hi Xavier,

Make sure that you have a ViewModel and that the Grid component is bound to it. Also, ensure that you are using a DataProvider to retrieve the data. Please examine the article below that describes in details how you can bind the Grid.




Regards,
Viktor Tachev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Xavier Mingo
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or