Width and Heigt problem

5 posts, 1 answers
  1. Markus
    Markus avatar
    196 posts
    Member since:
    Dec 2007

    Posted 17 Apr 2008 Link to this post

    The radEditor can be resized by user. Now I need the current height and width on server side. The properties doesn't return the correct value. How can I get those values?
  2. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 17 Apr 2008 Link to this post

    Hello Markus,

    There are javascript functions in the documentation that show you how to get the width and height, namely:

    editor.get_element().style.width;  
    editor.get_element().style.height; 

    Something that comes to mind for your needs would be to have a couple of asp:hiddenfield's on the page that have their values set on the client prior to making the trip to the server.  I don't think there is an OnResize function available so you'll have to do it prior to submitting.  For example, if you're using a standard asp:button you could use the OnClientClick to run the javascript that grabs the current height / width and sets the values to the hidden fields before the postback occurs.

    Shaun.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Markus
    Markus avatar
    196 posts
    Member since:
    Dec 2007

    Posted 17 Apr 2008 Link to this post

    Thanks for the hint, I get it work, hope there is soon a "OnClientResize" event or a "OnKeyPress" event for the radEditor.
  5. Answer
    Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 17 Apr 2008 Link to this post

    Hello Markus,

    You can use the attachEventHandler method of RadEditor to attach an event to the editor's content area. Here is an example how to attach to the onkeypress event of the content area:

    <script type="text/javascript">
    function OnClientLoad(editor, args)
    {                 
       editor.attachEventHandler("onkeypress", function(e)
       {
           alert("Content area key down " + e.keyCode);
       });
    }
    </script>
    <telerik:radeditor runat="server" ID="RadEditor1"
        OnClientLoad="OnClientLoad">
    </telerik:radeditor>

    The editor does not offer OnClientResize event.

    Best regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Markus
    Markus avatar
    196 posts
    Member since:
    Dec 2007

    Posted 18 Apr 2008 Link to this post

    Thanks for information! This is a better solution than my workarround. But the best way would be a "OnClinetRsize" together with a "AutoPostback".
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017