mimic commanditem in commanditemtemplate

5 posts, 1 answers
  1. Morten
    Morten avatar
    350 posts
    Member since:
    Jul 2012

    Posted 20 Aug 2010 Link to this post

    I generally use the standard commanditem. However, when I use the commanditemtemplate I'd like it to look like the standard skinned commanditem (buttons, links, etc.).

    How do I best go about this?
  2. Answer
    Dimo avatar
    8478 posts

    Posted 23 Aug 2010 Link to this post

    Hi Morten,

    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.

    Kind regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Roger Barnes
    Roger Barnes avatar
    38 posts
    Member since:
    May 2008

    Posted 16 Dec 2010 Link to this post

    <table border="0" style="width: 100%;" class="rgCommandTable">
        <td align="left">
        <asp:Button CommandName="InitInsert" runat="server" ID="btnAddNewRecord" Text=" " 
                    title="Add new record" CssClass="rgAdd" />
        <asp:LinkButton ID="lnkbAddNewRecord" CommandName="InitInsert" runat="server">
    new Record</asp:LinkButton>
        <td>Your Custom Commands Here</td>
        <td align="right">                                    
        <asp:Button CommandName="RebindGrid" runat="server" ID="btnRefresh" Text=" "
                title="Refresh" CssClass="rgRefresh" />
        <asp:LinkButton ID="lnkbRefresh" CommandName="RebindGrid" runat="server">Refresh</asp:LinkButton>
  4. Vasssek
    Vasssek avatar
    190 posts
    Member since:
    Aug 2010

    Posted 28 Aug 2016 in reply to Roger Barnes Link to this post



    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.

    Please help.

    Best regards


  5. Eyup
    Eyup avatar
    4046 posts

    Posted 01 Sep 2016 Link to this post

    Hi Vasssek,

    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
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top