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

[Solved] Want to used RadEditor to caputure Body part of the email

4 Answers 74 Views
Editor
This is a migrated thread and some comments may be shown as answers.
vick
Top achievements
Rank 1
vick asked on 17 Feb 2010, 11:41 PM
I Want to used RadEditor to caputure Body part of the email.
when i am typing 4 to 5 lines in radeditor without enter key, and send as Email, it comes up as one line...
for exapmle,
testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing

but i would like to have in email like.

testing testing testing testing testing testing
testing testing testing testing testing testing testing
testing testing testing testing testing testing

so i would like to have Radeditor to add <Br> some where but do not want to break the one word.
in other word i would like to give specific length for one line in editorm, and then after it will add <br>

Thanks in advance,
Vish

4 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 18 Feb 2010, 04:13 PM
Hi Vish,

I was able to implement the requested feature using the code below:

<asp:ScriptManager ID="scriptmanager1"  runat="server"></asp:ScriptManager> 
<script type="text/javascript"> 
function OnClientLoad(editor) 
{  
    var characters = 0; 
    editor.attachEventHandler ("onkeydown", function (e) 
    { 
        var content = editor.get_text(); //returns the editor's content as plain text 
          
        if (content)  
        {  
            var trimRegX = /(^\s+)|(\s+$)/g;  
            content = content.replace(trimRegX, "");  
            content = content.replace(/\n/gi,""); 
            content = content.replace(/\r/gi,""); 
            characters = content.length; 
             
            if (characters % 80 == 0) //specify how many characters to count before inserting a new line
            { 
                editor.pasteHtml("<br/>"); 
            } 
        }  
 
    var counter = $get("counter");     
    counter.innerHTML = " Characters: " + characters;  
    }); 
</script> 
 
<span id="counter"></span> 
<telerik:RadEditor id="RadEditor1" OnClientLoad="OnClientLoad" Runat="server"></telerik:RadEditor>  

This is just a demo, which you can use as a starting point. You should further enhance it to fit your scenario.

Greetings,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
vick
Top achievements
Rank 1
answered on 18 Feb 2010, 06:01 PM
Thank you so much for your quick reply.
i added the code give by you. but when the page get loaded it show the message
"Exception while executing client event Onclientload Error: object doesn;t support this property or method"
i just remove the code from the function and replace with
<script type="text/javascript">
function OnClientLoad(editor, args)
{                  
   editor.attachEventHandler("onkeydown", function(e)
   {
       alert("Content area key down " + e.keyCode);
   });
}
</script>
still has the same mesage box. so i think, once this message will go away, then the code inside in this function will start working.
Can you please help me out on this?

Thanks
Vish
0
Rumen
Telerik team
answered on 19 Feb 2010, 05:34 PM
Hi Vish,

Which version of RadEditor do you use: RadEditor Classic (RadEditor.dll) or RadEditor for ASP.NET AJAX (Telerik.Web.UI.dll) and which number?

The provided solution is tested with the latest version of RadEditor for ASP.NET AJAX (2009.3.1314) and works fine.

Best wishes,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
vick
Top achievements
Rank 1
answered on 19 Feb 2010, 10:58 PM
yes, you are correct. I changed with the newer version and it;s works. thank you so much for your help.
Tags
Editor
Asked by
vick
Top achievements
Rank 1
Answers by
Rumen
Telerik team
vick
Top achievements
Rank 1
Share this question
or