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

GridButtonColumn image size

1 Answer 857 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 05 Jun 2015, 03:12 PM

The image is a little Add png icon (from examples) and it blows it up.  I can't find anywhere to make it the normal size (or force a size).  ItemStyle-width or height, HeaderStyle-width or height, or what's below don't have any affect on it.  See screenshot.

 

                               <MasterTableView DataMember="Devices" DataKeyNames="ArticleID" headerStyle-Font-Bold="true" AllowFilteringByColumn="true" PageSize="20" >


                                    <Columns>

                                        <telerik:GridButtonColumn
                                            CommandName="InitInsert"
                                            Text="Add a Claim for this Device"
                                            UniqueName="AddNewClaim"
                                            ButtonType="imageButton"
                                            ImageUrl="../../resources/Images/AddRecord.png"> <HeaderStyle Width="1px" /><ItemStyle Width="1px" /> </telerik:GridButtonColumn>
              
                                        <telerik:GridBoundColumn
                                            SortExpression="SerialNumber"
                                            HeaderText="Serial Number"
                                            HeaderButtonType="TextButton"
                                            DataField="SerialNumber"
                                            UniqueName="SerialNumber"
                                            HeaderStyle-Width="400"
                                            FilterControlWidth="100"
                                            CurrentFilterFunction="EqualTo"
                                            AutoPostBackOnFilter="True"
                                            AllowFiltering="True" />

                                        <telerik:GridBoundColumn SortExpression="ArticleID" HeaderText="Article ID" HeaderButtonType="TextButton"
                                            DataField="ArticleID" UniqueName="ArticleID" HeaderStyle-Width="800" FilterControlWidth="800" Visible="false" />
                                    </Columns>

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 10 Jun 2015, 01:09 PM
Hi Chad,

Here are several approaches you can use to resolve this issue:

1.
<telerik:GridButtonColumn ... ButtonCssClass="imageButtonClass">
CSS:
<style type="text/css">
    .imageButtonClass {
        height: 20px;
    }
</style>

2.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = e.Item as GridDataItem;
        ImageButton button = item["AddNewClaim"].Controls[0] as ImageButton;
        button.Height = 20;
    }
}

3.
<telerik:GridTemplateColumn UniqueName="AddNewClaim">
    <ItemTemplate>
        <asp:ImageButton ID="ImageButton1" runat="server" CommandName="InitInsert"
            AlternateText="Add a Claim for this Device" ImageUrl="~/maps-icon.png"
            Height="20px" />
    </ItemTemplate>
</telerik:GridTemplateColumn>

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Chad
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or