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

Popup not firing for updated

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 15 Feb 2020, 05:45 PM

     Hi I have the following problem I have a keno grid bringing up a popup but its not firing my update command for some reason. The main difference to my site and the demos is that I am using language as part of my url.

 

      app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{culture=en-gb}/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();


            });

    @(Html.Kendo().Grid<Stock>()
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.ID);
            columns.Bound(p => p.Description).Width(180);
            columns.Bound(p => p.Name).Width(180);
            columns.Command(command => command.Edit()).Width(160);
            columns.Command(command => command.Destroy()).Width(160);
        })

    .ToolBar(toolbar =>
     {
         toolbar.Create();
         toolbar.Save();
     })
    .Pageable()
    .Navigatable()
    .Sortable()
    .Groupable()
    .Filterable()
    .Scrollable()
    .HtmlAttributes(new { style = "height: 500px" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error"))

          .Model(model =>
          {
              model.Field(p => p.ID).Editable(true);
              model.Field(p => p.Name);
          })

        .Read("ReadStock", "Stock")
        .Update("Stock_Update", "Stock"))
    .Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("StockEditorTemplate"))


       )
    )

 

        [AcceptVerbs("Post")]
        public async Task<ActionResult> Stock_Update([DataSourceRequest] DataSourceRequest request, Stock stockItem)
        {
            if (stockItem != null && ModelState.IsValid)
            {
                int x = await apiClient.PostUpdateStock(stockItem);
            }

            return Json(new[] {stockItem}.ToDataSourceResult(request, ModelState));
        }

 

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 20 Feb 2020, 07:01 AM

Hi, David,

I tried to reproduce the described behaviour using the provided Start.cs configuration to no avail. I also included controller methods with mocked async outcomes to be certain.

I am including the project here for your reference, perhaps you can see something else.

The only irregularity I noticed is the Save() button in the toolbar which is proprietary to the grid with batch data source and incell editing. You can start by removing that since popup editing is used and compare my project with yours.

Let me know what your findings are.

Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or