How to catch popup template save button click

2 posts, 0 answers
  1. Ed
    Ed avatar
    43 posts
    Member since:
    Dec 2019

    Posted 06 Feb 2020 Link to this post

    Is there a way to catch the click event for this and the cancel button?

    Thanks … Ed

     

  2. Nikolay
    Admin
    Nikolay  avatar
    301 posts

    Posted 11 Feb 2020 Link to this post

    Hi Ed,

    I would suggest subscribing to Save and Cancel events of the grid that are fired upon click on Update button and Cancel button respectively. This could be done like below.

    - Register the events:

    @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.ProductName);
            columns.Bound(p => p.Discontinued).Width(120);
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
        })
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Events(e => e.Save("onSave").Cancel("onCancel"))

    - Declare the event handlers:

        <script>
            function onSave(e) {
                console.log("save")
                e.preventDefault();
            }
    
            function onCancel(e) {
                console.log("cancel")
            }

    Additionally, I am sharing a forum thread discussing how to catch the event of the update button. I hope this would be helpful to you: https://www.telerik.com/forums/catch-event-and-getvalue-of-popup-edit-fields

    Let me know if you have any questions.

    Regards,
    Nikolay
    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