GridCommandColumn GridCommandButton text for add/edit

1 Answer 12 Views
Grid
Ryan
Top achievements
Rank 1
Iron
Iron
Iron
Ryan asked on 20 Aug 2025, 06:26 PM
How can I change the text for the save command for a row to say add when it's adding a new item and Update when it's updating a new item? Is there no official way and I have to manually do that? Thanks!

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 20 Aug 2025, 07:00 PM

Hi Ryan,

My answer assumes that you are using inline Grid edit mode. You can set the Save command button text at runtime, depending on which Grid event fired - OnAdd or OnEdit.

<TelerikGrid OnAdd="@OnGridAdd"
                    OnEdit="@OnGridEdit">
    <GridColumns>
        <GridCommandColumn>
            <GridCommandButton Command="Save" ShowInEdit="true">@SaveButtonText</GridCommandButton>
        </GridCommandColumn>
    </GridColumns>
</TelerikGrid>

@code {
    private string SaveButtonText { get; set; } = "Save"; // practically never used

    private void OnGridAdd(GridCommandEventArgs args)
    {
        SaveButtonText = "Add";
    }

    private void OnGridEdit(GridCommandEventArgs args)
    {
        SaveButtonText = "Update";
    }
}

 

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dimo
Telerik team
Share this question
or