Using html tags in CancelText() etc. does not work any more, because it is escaped

1 Answer 24 Views
Grid
Boardy
Top achievements
Rank 1
Veteran
Boardy asked on 27 Feb 2025, 10:51 AM

Recently I upgraded Kendo in a project from a 2020 version to the current version. It seems CancelText() and UpdateText() etc. of the command column in a grid have changed and now perform html escaping on the value. This results in the html code being shown to the user instead of what was intended.

Is it possible (and how) to get the old behaviour back?

The intended use is to have just an icon (not from the kendo set) on the button and no further text. So setting the CancelIconClass to "none" and putting the icon's html snippet in the text, used the achieve the intended result. But this method doesn't work any more.

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivaylo
Telerik team
answered on 04 Mar 2025, 09:15 AM

Hello Boardy,

Thank you for the details provided.

If the use of Kendo icons is not desired and the button should display only text, the CancelText property can be set to an empty string. Additionally, FontAwesome icons can be used for the icons. The CancelIconClass property can be used to specify the FontAwesome icon classes.However, for this approach to function correctly, FontAwesome must be referenced in the project. Below is an example of the implementation:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />

.Columns(columns =>
{
    columns.Bound(p => p.OrderID).Filterable(false);
    columns.Bound(p => p.Freight);
    columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
    columns.Bound(p => p.ShipName);
    columns.Bound(p => p.ShipCity);

    columns.Command(p => p.Edit().CancelIconClass("fa-solid fa-xmark").CancelText(" "));
})

Furthermore, I prepared a sample application where the suggested modifications could be tested. The application is attached to this reply.

I hope this information was helpful.

Kind Regards,
Ivaylo
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
Grid
Asked by
Boardy
Top achievements
Rank 1
Veteran
Answers by
Ivaylo
Telerik team
Share this question
or