Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The Insert data binding setting is required by the insert command Kendo Grid Error anyone

Kendo Grid show the following ERROR

The Insert data binding setting is required by the insert command. Please specify the Insert action or url in the DataBinding configuration

@(Html.Kendo().Grid<Pa.Portal.KazangService.KazangAccount>()
    .Name("grids")
    .Columns(columns =>
    {
        columns.Bound(g => g.Id);
        columns.Bound(g=>g.UserName);
        columns.Bound(g=>g.Password);
        columns.Bound(g=>g.Channel);
       
    })
    .ToolBar(toolbar => toolbar.Create()) 
    .Pageable()
    .Sortable()
    .Scrollable()
    .AutoBind(true)
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)      
        .Model(m => m.Id(h => h.Id))      
        .Read(read => read.Action("LoadAllkazangAccounts", "Kazang"))    
        ))

CONTROLLER


  public ActionResult LoadAll([DataSourceRequest] DataSourceRequest request)
        {
            IKazangBusinessService client = PaChannelFactory<IKazangBusinessService>.Default.CreateChannel();
            IEnumerable<KazangAccount> KaList = client.GetAllKazangAccounts().ToList();
            ((IChannel)client).Close();
            return Json(KaList.ToDataSourceResult(request));
        }
like image 974
Farai Avatar asked Jan 08 '15 14:01

Farai


Video Answer


1 Answers

The reason why you are getting this error is down to the fact you have added the Create button in your toolbar.

With this added to the grid the datasource section is looking for the create command path.

eg. for your read action you have

.Read(read => read.Action("LoadAllkazangAccounts", "Kazang"))   

so you need to add the appropriate insert action like:

.Create(create=> create.Action("CreatekazangAccounts", "Kazang"))   

if you don't need to create anything in this grid then just remove the create toolbar menu item from the grid.

like image 93
David Shorthose Avatar answered Oct 24 '22 02:10

David Shorthose