Ravikumar
Ravikumar

Reputation: 625

How to change Telerik RadEditor width

I have Telerik Rad Editor and trying to change using CSS. but it does not applying.

here is my code:

 <telerik:RadEditor
    ClientIDMode="Static"
    ID="objRadEditor"
    AutoResizeHeight="true"
    EnableResize="false"
    EditModes="Design,Html"
    runat="server"
    StripFormattingOptions="all"
    Width="100%" Height="140px"
    ToolsFile="~/xml/RadEditorBasicToolsFile.xml">
    <ContextMenus>
    <telerik:EditorContextMenu Enabled="false" TagName="A">
    </telerik:EditorContextMenu>
    </ContextMenus> 
</telerik:RadEditor>

Upvotes: 1

Views: 584

Answers (1)

Veselin Vasilev
Veselin Vasilev

Reputation: 3793

It seems RadEditor's Width does not work with percentage values, so you can use a workaround like this one http://www.telerik.com/forums/radeditor-width-100#rSSLKsUzgkSy7WtjmGGlBg

By design RadEditor does not support size in percentages and this is why its size is not reset when browser window is resized.

The only possible approach I could suggest you is to implement your all Client-Side logic on the Editor's load and the window resize events. In this function you could take the current size of the browser window and set it as a width of the RadEditor control by using its setSize() method. You can do it in a similar way:

<telerik:RadEditor Width="100px" Height="750px" ID="RadEditor1" Skin="Silk" runat="server" OnClientLoad="resizeEditor"
    _ToolsFile="/Admin/DocumentsManagementV3/xml/ToolsFile.xml" _SkinID="DefaultSetOfTools">
</telerik:RadEditor>
<script type="text/javascript">
    Sys.Application.add_load(function () {
        window.onresize = resizeEditor;
    })

    function resizeEditor() {
        var editor = $find("<%=RadEditor1.ClientID %>");
        //set the width and height of the RadEditor
        var windowWidth = $telerik.$(window).width();
        var editorHeight = $telerik.$("#" + editor.get_id()).height();
        editor.setSize(windowWidth - 20, editorHeight);
    }
</script>

Upvotes: 2

Related Questions