Editor in Radwindow Template

6 posts, 0 answers
  1. david
    david avatar
    228 posts
    Member since:
    May 2007

    Posted 02 Nov 2011 Link to this post

    I'm trying to use a radeditor inside a radwindow template (so I can get the results in code-behind).  I used this demo as a template:
    http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx

    The other controls in the template render and function fine but the radeditor simply does not appear

        <telerik:RadWindow runat="server" ID="RadWindow_ContentTemplate" RestrictionZoneID="ContentTemplateZone"
            Width="700px" Height="500px" Modal="true">
            <ContentTemplate>
                <div class="contButton">
                    <asp:TextBox ID="Textbox1" runat="server" />
                </div>
                <asp:TextBox ID="tbxCombinedFile" runat="server" />
                <div class="contButton">
                    <asp:Button ID="Button2" Text="send value through code-behind" runat="server" OnClick="Button2_Click" /></div>
                <asp:Button ID="btnSaveEditor" Text="Save File through code-behind" runat="server"
                    OnClick="btn_Editor_Save" /></div>
                <div id="editorWrapper" style="padding5pxdisplaynone;">
                    <telerik:RadEditor runat="server" ID="RadEditor1" Height="444px" EditModes="All"
                        StripFormattingOnPaste="None" StripFormattingOptions="None" ToolbarMode="Default"
                        Width="699px" Skin="Telerik">
                        <Content>
                        </Content>
                        <SpellCheckSettings SpellCheckProvider="PhoneticProvider" WordIgnoreOptions="None">
                        </SpellCheckSettings>
                    </telerik:RadEditor>
                </div>
            </ContentTemplate>
        </telerik:RadWindow>
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4613 posts

    Posted 03 Nov 2011 Link to this post

    Hello David,

    There is a known issue in this scenario. The RadWindow moves its content in the DOM (so as to render it as a direct child of the form element) and this breaks the RadEditor. There is a simple workaround, however - call the Editor's onParentNodeChanged() method when you show the RadWindow:
    <telerik:RadWindow runat="server" ID="RadWindow_ContentTemplate" OnClientShow="fixEditor" . . . >
    . . . . . .
    </telerik:RadWindow>

    function fixEditor()
    {
        $find("<%=RadEditor1.ClientID %>").onParentNodeChanged();
    }

    The exact behavior you describe, however, is a result of the display: none being set to the RadEditor's parent:
    <div id="editorWrapper" style="padding: 5px; display: none;">
                    <telerik:RadEditor runat="server" ID="RadEditor1"


    Once removed things should be working as expected.

    Greetings,
    Marin
    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. david
    david avatar
    228 posts
    Member since:
    May 2007

    Posted 03 Nov 2011 Link to this post

    Hi Marin,  I tried the changes and no joy, here is the updated code
       
    
        <telerik:RadWindow runat="server" ID="RadWindow_ContentTemplate" RestrictionZoneID="ContentTemplateZone"
            Width="700px" Height="500px" Modal="true" OnClientShow="fixEditor">
            <ContentTemplate>
                    <asp:TextBox ID="Textbox1" runat="server" />
                <asp:TextBox ID="tbxCombinedFile" runat="server" />
                <div class="contButton">
                    <asp:Button ID="Button2" Text="send value through code-behind" runat="server" OnClick="Button2_Click" /></div>
                <asp:Button ID="btnSaveEditor" Text="Save File through code-behind" runat="server" OnClick="btn_Editor_Save" /></div>
     
                    <telerik:RadEditor runat="server" ID="RadEditor1"  EditModes="All"
                        StripFormattingOnPaste="None" StripFormattingOptions="All" ToolbarMode="Default" 
                        Skin="Telerik">
                        <Content>
                        </Content>
                        <SpellCheckSettings SpellCheckProvider="PhoneticProvider" WordIgnoreOptions="None">
                        </SpellCheckSettings>
                    </telerik:RadEditor>
     
            </ContentTemplate>
        </telerik:RadWindow>
                     <script type="text/javascript">
                        function fixEditor() {
                            $find("<%=RadEditor1.ClientID %>").onParentNodeChanged();
                        }
    
  4. david
    david avatar
    228 posts
    Member since:
    May 2007

    Posted 04 Nov 2011 Link to this post

    Guys, any suggestions ?
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4613 posts

    Posted 04 Nov 2011 Link to this post

    Hi David,

    In your current code there is a closing </div> tag that has no opening tag, right after the btnSaveEditor button. This causes the RadWindow's contentTemplate to be closed prematurely and thus the RadEditor is left out of it. I am attaching the page where I tested your code and things are working fine for me after I corrected the HTML. I would also advise that you change the ID of the RadWindow, as this resembles the ID of the ContentTemplate itself too closely, just in case.


    All the best,
    Marin
    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
  6. david
    david avatar
    228 posts
    Member since:
    May 2007

    Posted 04 Nov 2011 Link to this post

    Thank you so much
Back to Top