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

Custom button with default image in CommandItemTemplate

3 Answers 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 13 Apr 2010, 09:53 PM
Ive tried the following, but the image is broken when rendered, any advice?  Bonus points if it can render the image from active Skin vs. a preset one.

                    <CommandItemTemplate> 
                        <div style="padding:3px 7px 4px;"
                            <asp:ImageButton id="btnAdd" runat="server" ImageUrl='<%= Page.ClientScript.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Outlook.Grid.AddRecord.gif") %>' /> 
                        </div> 
                    </CommandItemTemplate> 

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 19 Apr 2010, 09:59 AM
Hello Marc,

I hope this approach will be suitable for you:
<CommandItemTemplate>
    <div style="padding: 3px 7px 4px;">
        <asp:ImageButton ID="btnAdd" runat="server"
           ImageUrl='<%# Page.ClientScript.GetWebResourceUrl(typeof(RadGrid), String.Format("Telerik.Web.UI.Skins.{0}.Grid.AddRecord.gif", RadGrid1.Skin)) %>' />
    </div>
</CommandItemTemplate>

Regards,
Daniel
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.
0
Marc
Top achievements
Rank 1
answered on 19 Apr 2010, 07:13 PM
Close... for the skin "Hay" it rendered the small cross/image but it wasn't green and instead was the same bg color as the command row default bg color.  Is there additional css that needs to go with this?
0
Daniel
Telerik team
answered on 22 Apr 2010, 02:41 PM
Hello Marc,

Do you use RadSkinManager? If this is the case, you should get the skin name from RadSkinManager instead of RadGrid:
<CommandItemTemplate>
    <div style="padding: 3px 7px 4px;">
        <asp:ImageButton ID="btnAdd" runat="server"
           ImageUrl='<%# Page.ClientScript.GetWebResourceUrl(typeof(RadGrid), String.Format("Telerik.Web.UI.Skins.{0}.Grid.AddRecord.gif", RadSkinManager1.Skin)) %>' />
    </div>
</CommandItemTemplate>

Kind regards,
Daniel
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.
Tags
Grid
Asked by
Marc
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Marc
Top achievements
Rank 1
Share this question
or