Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 78072

Why is my grid calling create for every row of data?

$
0
0

Why is my grid calling "CreateFooBar" for every row of data when delete and update are submitted? It's probably something stupid but I can't see it.

 

   @(Html.Kendo()
          .Grid<FooBarViewModel>()
          .Name("FooBarGrid")
          .Sortable()
          .Scrollable()
          .Filterable()
          .Resizable(g => g.Columns(true))
          .Columns(columns =>
          {
              columns.Command(command =>
              {
                  command.Edit();
                  command.Destroy();
              }).Width(150);
              columns.Bound(g => g.Id).Hidden();
              columns.Bound(g => g.Name).Title("Name").Width(200);
              columns.Bound(g => g.FooBarNumber).Title("FooBar<br />Number").Width(200);
              columns.Bound(g => g.CreatedBy).Width(100).Title("Created By");
              columns.Bound(g => g.CreatedDate).Width(100).Title("Created Dt");
              columns.Bound(g => g.ModifiedBy).Title("Modified By").Width(100);
              columns.Bound(g => g.ModifiedDate).Width(100).Title("Modified Dt");
          })
          .DataSource(dataSource => dataSource.Ajax()
              .Model(model =>
              {
                  model.Id(m => m.Id);
                  model.Field(p => p.CreatedBy).Editable(false);
                  model.Field(p => p.CreatedDate).Editable(false);
                  model.Field(p => p.ModifiedDate).Editable(false);
                  model.Field(p => p.ModifiedBy).Editable(false);
              })
              .Batch(false)
              .PageSize(25)
              .ServerOperation(false)
              .Read(read => read.Action("GetFooBars", "FooBar"))
              .Create(update => update.Action("CreateFooBar", "FooBar"))
              .Update(update => update.Action("UpdateFooBar", "FooBar"))
              .Destroy(update => update.Action("DeleteFooBar", "FooBar"))
              .Events(ev => ev.RequestEnd("onSave"))
              .Events(events => { events.Error("onError"); })
          )
          .ClientDetailTemplateId("collectionTemplate")
          .Events(ev => ev.Edit("onEdit"))
          .ToolBar(toolbar =>
          {
                  toolbar.Create().Text("Add FooBar");   
          })
          
          .Editable(editable => editable.Mode(GridEditMode.InLine))
                  .Pageable(pager => pager
                        .Input(true)
                        .Numeric(true)
                        .Info(true)
                        .PreviousNext(true)
                        .Refresh(true)
                        .PageSizes(new int[5] { 25, 50, 100, 200, 500 })
                    )
                    .ColumnMenu()
    )


Viewing all articles
Browse latest Browse all 78072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>