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

How to catch popup template save button click

1 Answer 310 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Iron
Veteran
Iron
Ed asked on 06 Feb 2020, 09:30 AM

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

Thanks … Ed

 

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 11 Feb 2020, 09:16 AM

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.
Tags
Grid
Asked by
Ed
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Nikolay
Telerik team
Share this question
or