This is a migrated thread and some comments may be shown as answers.

Width and Heigt problem

4 Answers 107 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 17 Apr 2008, 09:33 AM
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?

4 Answers, 1 is accepted

Sort by
0
Shaun Peet
Top achievements
Rank 2
answered on 17 Apr 2008, 12:47 PM
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.
0
Markus
Top achievements
Rank 1
answered on 17 Apr 2008, 02:05 PM
Thanks for the hint, I get it work, hope there is soon a "OnClientResize" event or a "OnKeyPress" event for the radEditor.
0
Accepted
Rumen
Telerik team
answered on 17 Apr 2008, 02:42 PM
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
0
Markus
Top achievements
Rank 1
answered on 18 Apr 2008, 06:48 AM
Thanks for information! This is a better solution than my workarround. But the best way would be a "OnClinetRsize" together with a "AutoPostback".
Tags
Editor
Asked by
Markus
Top achievements
Rank 1
Answers by
Shaun Peet
Top achievements
Rank 2
Markus
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or