GridButtonColumn image size

2 posts, 0 answers
  1. Chad
    Chad avatar
    1 posts
    Member since:
    Jun 2015

    Posted 05 Jun 2015 Link to this post

    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>

  2. Eyup
    Admin
    Eyup avatar
    3841 posts

    Posted 10 Jun 2015 Link to this post

    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
Back to Top