This is a migrated thread and some comments may be shown as answers.
Dock does not shrink to fit in IE7
2 Answers 30 Views
This is a migrated thread and some comments may be shown as answers.
Pascal
Top achievements
Rank 1
Pascal asked on 06 Jul 2009, 05:33 PM
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 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 08 Jul 2009, 01:54 PM
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
 
    <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); 
        } 
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
        <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" OnClientInitialize="DockInitialize" style="width:auto;"
            <ContentTemplate> 
                <div id="RadDock1_div"
                    <telerik:RadEditor ID="RadEditor1" runat="server"
                    </telerik:RadEditor> 
                </div> 
            </ContentTemplate> 
        </telerik:RadDock> 
    </telerik:RadDockLayout> 
    <asp:Button ID="Button1" runat="server" Text="Make Width Unit.Empty" OnClick="Button1_Click" /> 
    </form> 
</body> 
</html> 
 



Best wishes,
Pero
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.
0
Pascal
Top achievements
Rank 1
answered on 10 Jul 2009, 08:12 AM
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!
Tags
Dock
Asked by
Pascal
Top achievements
Rank 1
Answers by
Pero
Telerik team
Pascal
Top achievements
Rank 1
Share this question
or