Domanda

For some reason, I can't get my RadEditor to resize itself on window.resize. My javascript function getsCalled but nothing seems to modify the RadEditor's appearance.

In the first place, I thought it'd resize by itself but it's not...it is resizing only once its content is updated from server.

Here's my RadEditor:

 <telerik:RadEditor ID="RadEditor1" Runat="server"
                        OnClientLoad="OnRadEditorClientLoad" 
                        OnClientCommandExecuting="OnClientCommandExecuting"
                        EnableResize="true" ContentAreaMode="Div"
                        AutoResizeHeight="true"
                        Height="20px"
                        Width="100%" 
                        EditModes="Design"
                        Skin="Web20">
  </telerik:RadEditor>

Here's my javascript function:

window.onresize = ResizeControls;
    function ResizeControls() {
        var editor = $find("<%=RadEditor1.ClientID %>");
        editor.get_element().style.width = getDocWidth() + "px";
        editor.get_contentArea().style.width = getDocWidth() + "px";
    }

Where getDocWidth() is returning the correctly modified width. (And yes, the "px" gotta be there). If I check editor's width, it's been modified correctly...I jst need to refresh or repaint the control.

So, on first load, my RadEditor is taking 100% of window's width. But after window.resize from 1000px to 800px, the RadEditor's width is still 1000px.


Explicit solution: Remove Width=100% and adjust width in the OnClientLoad event:

 <telerik:RadEditor ID="RadEditor1" Runat="server"
                    OnClientLoad="OnRadEditorClientLoad" 
                    OnClientCommandExecuting="OnClientCommandExecuting"
                    EnableResize="true" ContentAreaMode="Div"
                    AutoResizeHeight="true"
                    Height="20px"
                    EditModes="Design"
                    Skin="Web20">
  </telerik:RadEditor>


    function OnRadEditorClientLoad(editor, args) {
        editor.get_element().style.width = getDocWidth()= + "px";
    }

    window.onresize = AsjustRadEditorsWidth;
    function AsjustRadEditorsWidth() {
        var editor = $find("<%=EnonceContainer.ClientID %>");
        editor.get_element().style.width = getDocWidth() + "px";
    }
È stato utile?

Soluzione

RadControls for ASP.NET AJAX Documentation RadEditor setSize

In addition to setSize method call, try to reset min-width and min-height css properties of editor's div element:

$telerik.$($find("<%=RadEditor1.ClientID %>")).css({"min-width": "", "min-height": ""});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top