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

Setting button width in %, firefox problem.

1 Answer 71 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Ken Lester
Top achievements
Rank 1
Ken Lester asked on 08 Oct 2009, 07:50 PM
Hi,
When i set the width of the toolbar button in percentage, firefox(v3.5.3) will not be able to display correctly. Any solution?
<CommandItemTemplate> 
                                <telerik:RadToolBar ID="RadToolBar1" runat="server" CausesValidation="False" Skin="Sunset" 
                                    OnClientButtonClicking="OnClientButtonClicking" AutoPostBack="True"  
                                   style="display:block; float: none"
                                    <Items> 
                                      <telerik:RadToolBarButton runat="server"  Text="Add New" 
                                            CommandName="AddNew" Width="20%"
                                        </telerik:RadToolBarButton> 
                                        
                                        <telerik:RadToolBarButton runat="server" Text="Delete" 
                                            CommandName="DeleteFile" Width="20%"
                                        
                                        </telerik:RadToolBarButton> 
                                        <telerik:RadToolBarButton runat="server"  Text="Refresh" 
                                            CommandName="Refresh" Width="20%" > 
                                        </telerik:RadToolBarButton> 
                                       
                                        <telerik:RadToolBarButton runat="server" Text="AutoRefresh OFF" 
                                            CommandName="Autorefresh" AllowSelfUnCheck="True" CheckOnClick="True" Width="20%"
                                        
                                        </telerik:RadToolBarButton> 
                                        <telerik:RadToolBarDropDown runat="server" Text="Filter Files" > 
                                            <Buttons> 
                                                <telerik:RadToolBarButton runat="server" Text="All Files" CommandName="FilterAllFile" Width="20%"
                                                </telerik:RadToolBarButton> 
                                                <telerik:RadToolBarButton runat="server" Text="Ready Files" CommandName="FilterReadyFile"
                                                </telerik:RadToolBarButton> 
                                                <telerik:RadToolBarButton runat="server" Text="Error Files" CommandName="FilterErrorFile"
                                                </telerik:RadToolBarButton> 
                                                <telerik:RadToolBarButton runat="server" Text="Processing Files" CommandName="FilterProcessingFile"
                                                </telerik:RadToolBarButton> 
                                            </Buttons> 
                                        </telerik:RadToolBarDropDown> 
                                    </Items> 
                                </telerik:RadToolBar> 
                            </CommandItemTemplate> 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 12 Oct 2009, 12:55 PM
Hello Ken,

You cannot set the width of RadToolBar buttons in percentages. You should set it in javascript in OnClientLoad event handler of the toolbar:

<script type="text/javascript">
        function clientLoad() {
            var toolbar = $find("<%=RadToolBar1.ClientID %>");
            var btnWidth = toolbar.get_element().clientWidth / 5;
            for (var i = 0; i < toolbar.get_items().get_count();  i++)
                toolbar.get_items().getItem(i).get_element().style.width = btnWidth + "px";
        }
        window.onresize = clientLoad;
</script>


All the best,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ToolBar
Asked by
Ken Lester
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or