RadWindow ContentTemplate, RadFormDecorator and DropDownList

5 posts, 0 answers
  1. Kern
    Kern avatar
    7 posts
    Member since:
    Mar 2009

    Posted 26 Mar 2013 Link to this post

    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>


  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 27 Mar 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kern
    Kern avatar
    7 posts
    Member since:
    Mar 2009

    Posted 28 Mar 2013 Link to this post

    I see, thanks for the advice!
  5. Kern
    Kern avatar
    7 posts
    Member since:
    Mar 2009

    Posted 28 Mar 2013 Link to this post

    Is there anyway I can do this elegantly for all RadWindows without having to repeat the javascript?
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 29 Mar 2013 Link to this post

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