Kendo grid – How to use different button texts on Add and Edit

kendo-asp.net-mvckendo-gridkendo-ui

I have a simple customization to make on my Inline Editable Kendo grid.

That is When I Add a new record, The Update button should be showing 'Insert' and on Edit mode, it should have the default 'Update' button name.

I know I can replace the button names using commands as shown below

columns.Command(commands =>
                {

                    commands.Edit()
                        .Text("MyCustomEdit")
                        .UpdateText("MyCustomUpdate")
                        .CancelText("MyCustomCancel");


                })

But only in case on Insert new record, how can I achieve this?

To make it more clear, we have Updateand Cancelbuttons displayed on click of Insert New recordas well as on click of Edit(Editing an existing grid row).

On click of Insert New record I want to see the text of the Update button as Create, where as on editing an existing row, the text of the button should remain as Update

On Insert
enter image description here

On Edit
enter image description here

Best Answer

Found a way by having below code in Edit event

function OnEdit(e){
    if (e.model.isNew())
    {

        var update = $(e.container).parent().find(".k-grid-update");
        $(update).html('<span class="k-icon k-update"></span>Insert');
    }
}
Related Topic