Dock does not shrink to fit in IE7

3 posts, 0 answers
  1. Pascal
    Pascal avatar
    15 posts
    Member since:
    Mar 2009

    Posted 06 Jul 2009 Link to this post

    We're using a RadDock and as we have to display some localized labels in there, we don't want to give it a fixed size, but we want it to behave in a 'shrink-to-fit' way. For some reason the width property is initialized with a DefaultAttribute of 300. When we set it to Unit.Empty it looks fine in Firefox (it shrinks to fit as expected). Unfortunately in IE7 the Rad is doing strange things, its right border always expands till to the right window border. Do you have any idea why it is doing this?
  2. Pero
    Pero avatar
    1156 posts

    Posted 08 Jul 2009 Link to this post

    Hi Pascal,

    The only way to resize the RadDock to fit to its content is to resize it via JavaScript. Here is a sample code which demonstrates how to do it:

    <%@ Page Language="C#" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> 
    <html xmlns=""
    <head runat="server"
        <script type="text/javascript"
            function DockInitialize(dock, args) 
                var innerDiv = $get(dock.get_id() + '_div'); 
                var innerDivSize = $telerik.getBounds(innerDiv); 
                dock.set_width(innerDivSize.width + 3); 
        <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
            <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" OnClientInitialize="DockInitialize" style="width:auto;"
                    <div id="RadDock1_div"
                        <telerik:RadEditor ID="RadEditor1" runat="server"
        <asp:Button ID="Button1" runat="server" Text="Make Width Unit.Empty" OnClick="Button1_Click" /> 

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Pascal
    Pascal avatar
    15 posts
    Member since:
    Mar 2009

    Posted 10 Jul 2009 Link to this post

    Got a bit more comlicated in the end, because our Dock is initially not visible so when the OnClientInitialze event fires the div still has a width of 0, but finally we managed to attached a similar script to the RadDockManager which is executed when the dock is displayed. Anyway, just wanted to say thanks for your support!
Back to Top