Template for columns.Command?

3 posts, 1 answers
  1. Ryan
    Ryan avatar
    91 posts
    Member since:
    Aug 2012

    Posted 20 Feb 2020 Link to this post

    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.


  2. Answer
    Alex Hajigeorgieva
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 25 Feb 2020 Link to this post

    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:

    .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.
  3. Ryan
    Ryan avatar
    91 posts
    Member since:
    Aug 2012

    Posted 26 Feb 2020 in reply to Alex Hajigeorgieva Link to this post

    Thanks Alex!
Back to Top