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

[Solved] RADEditor Code Snippet

1 Answer 197 Views
Editor
This is a migrated thread and some comments may be shown as answers.
SnailHi
Top achievements
Rank 1
SnailHi asked on 27 Oct 2009, 01:14 PM
Is it possible to retrieve date and time as part of a code snippet. I want users to be able to click the 'Insert Code Snippet' and insert a snippet which puts in the date and time. All the examples just show pure HTML.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 30 Oct 2009, 06:38 AM
Hi SnailHi,

You can add programmatically the date and time to the templace html content by attaching to the OnClientPasteHtml event of RadEditor and executing the following function:

<telerik:RadEditor ID="RadEditor1" OnClientPasteHtml="OnClientPasteHtml" runat="server">
    <TemplateManager ViewPaths="~/" UploadPaths="~/" />
</telerik:RadEditor>
<script type="text/javascript">
function OnClientPasteHtml(sender, args)
{
    var commandName = args.get_commandName();
    var value = args.get_value();
     
         
    if (commandName == "TemplateManager")
    {
        args.set_value(value + '<span style="width:200px;border: 1px dashed #bb0000;background-color: #fafafa;color: blue;"> ' + new Date() + ' </span>');
    }
}
</script>


Greetings,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
SnailHi
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or