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

Template for columns.Command?

2 Answers 1338 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 20 Feb 2020, 12:37 PM

Is there a template for columns.Command(command => command.Custom(template).Click("showDetails")).Width(45);

I want to show button with Icon instead of text.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 25 Feb 2020, 11:42 AM

Hello, Ryan,

To show only text in the built in buttons, you can set there text to be a space:

columns.Command(p =>
{
     p.Edit().Text(" ");
     p.Destroy().Text(" ");
 
});

To add a template and a command button, you can use this syntax. It is important to note that the click handler is attached to an element with class "k-grid-myCommand that is generated using the string in the Custom method highlighted below:

c.Command(command=>command.Custom("myCommand")
.Template("Some text here<a class='k-button k-grid-myCommand'><span class='k-icon k-i-copy'></a>")
.Click("function(){kendo.alert('Custom Command')}"));

In case you do not wish to use a template for the custom command, you can just set the text as empty string:

c.Command(command=>command.Custom("myCommand").Text(" ").IconClass("k-icon k-i-eye").Click("myClickFunction"));

Kind Regards,
Alex Hajigeorgieva
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.
0
Ryan
Top achievements
Rank 1
answered on 26 Feb 2020, 05:18 PM
Thanks Alex!
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or