Popup not firing for updated

2 posts, 0 answers
  1. David
    David avatar
    77 posts
    Member since:
    Nov 2011

    Posted 15 Feb 2020 Link to this post

         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));
            }

     

     

     

     

     

     

     

     

  2. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 20 Feb 2020 Link to this post

    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.
Back to Top