7 Answers, 1 is accepted
The easiest way is to use the same HTML code (or similar one) as the one that is used internally by RadGrid. Please inspect the command item HTML output and take what you need from there. The internal HTML output of the command item is wrapped by a table cell with a rgCommandCell CSS class. All the HTML code that you have to review is wrapped inside a <table> :
<table border="0" style="width: 100%;" class="rgCommandTable">
By default, the command row uses the so called sprite buttons:
Here is how to mimic such a button inside the RadGrid CommandItemTemplate:
<asp:Button CssClass="rgAdd" Text=" " />
The CSS class and the single-spaced Text property matter the most.
the Telerik team
I know this is 6years old topic, but what If I want to use commanditemtemplate and RadGrid render mode is set to Auto or Lightweight ? Then all command buttons are without css images.
Generally, you can use the auto-generated CommandItem and add your additional controls during the ItemCreated event handler. Could you elaborate on your specific requirement and send us sample videos or screenshots demonstrating the desired appearance?
Telerik by Progress
I am having the same issue. very odd. if the RadGrid is rendered as "Auto" or "Lightweight" the images do not appear in the asp buttons. if i change the RadGrid to "Classic" they show the color icons. I looked at the mark-up and it seems to use the same CssClass="rgRefresh" for either of the three RenderModes.
I attached images, I am trying to get the CommandItemTemplate to look like notemp-auto-OK.jpg, but i get temp-auto-BAD.jpg
Code for CommandItemTemplate
Hi Telerik, can you address this issue? Give me some type of a work around would be great.
The main difference between the Classic and Lightweight render modes are the use of font-icons instead of background images and the different generated HTML in some cases, so, the styles for Classic and Lightweight render mode might differ.
With that said, having the same type of control loaded on the page in two different render modes will lead to a Mixed render mode issue:
On the other hand, the font-icons require internal elements that would contain the icon itself, which is not possible with the asp:button. To fix that, you can use the RadButton or any of the lightweight alternatives of the Button, such as the PushButton for example:
I hope that brings more clarity to the situation and why the observed appearance is expected with that setup.
Give the PushButton a try and share your new setup if you still experience issues.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.