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

RadWindow ContentTemplate, RadFormDecorator and DropDownList

4 Answers 87 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kern Shen
Top achievements
Rank 1
Kern Shen asked on 26 Mar 2013, 09:31 AM
There seems to be a bug when a dropdownlist is placed in a RadWindow's ContentTemplate and is decorated by RadFormDecorator.

With RadFormDecorator, the RadWindow will appear with scrollbars.  Seems like RadFormDecorator screw up RadWindows AutoSize height calculation.

    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
    <telerik:RadWindow runat="server" ID="wUserForm" VisibleOnPageLoad="true" AutoSize="true">
        <ContentTemplate>
            <table>
                <tr>
                    <td>test</td>
                    <td>
                        <asp:DropDownList ID="DropDownList1" runat="server">
                            <asp:ListItem>aaaaaaaa</asp:ListItem>
                            <asp:ListItem>bbbbbbbb</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </telerik:RadWindow>


4 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 27 Mar 2013, 09:53 AM
Hi Kern,

You need to redecorate the content of the RadWindow after you show it, because it is moved in the DOM at this point. Once this is done some dimensions of the elements may change, so you could call the autoSize() method again
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
<telerik:RadWindow runat="server" ID="wUserForm" VisibleOnPageLoad="true" AutoSize="true" OnClientShow="decorateContent">
    <ContentTemplate>
        <table>
            <tr>
                <td>
                    test
                </td>
                <td>
                    <asp:DropDownList ID="DropDownList1" runat="server">
                        <asp:ListItem>aaaaaaaa</asp:ListItem>
                        <asp:ListItem>bbbbbbbb</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
    </ContentTemplate>
</telerik:RadWindow>
<script type="text/javascript">
    function decorateContent(sender)
    {
        $find("<%=RadFormDecorator1.ClientID %>").decorate(sender.get_contentElement());
        setTimeout(function ()
        {
            sender.autoSize();
        }, 0)
    }
</script>

This works fine with me and you can find attached several screenshots with the appearance before and after adding the script.

If this is not the case with you could you confirm that you are using the latest version and if not - does upgrading help?

Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Kern Shen
Top achievements
Rank 1
answered on 29 Mar 2013, 02:39 AM
I see, thanks for the advice!
0
Kern Shen
Top achievements
Rank 1
answered on 29 Mar 2013, 02:59 AM
Is there anyway I can do this elegantly for all RadWindows without having to repeat the javascript?
0
Marin Bratanov
Telerik team
answered on 29 Mar 2013, 04:20 PM
Hello Kern ,

You can attach the same handler for all RadWindows that need it. It uses the Client-side API of the control to pass the current content to RadFormDecorator, so it will work with various instances.


Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Kern Shen
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Kern Shen
Top achievements
Rank 1
Share this question
or