Setting button width in %, firefox problem.

2 posts, 0 answers
  1. Ken Lester
    Ken Lester avatar
    4 posts
    Member since:
    Jul 2009

    Posted 08 Oct 2009 Link to this post

    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> 

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 12 Oct 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top