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

EditorDropDown not pasting value OnClientCommandExecuting in internet explorer

1 Answer 48 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Parimal
Top achievements
Rank 1
Parimal asked on 31 Jan 2013, 01:24 PM
Hi,I have radeditor  with editor drop down which is dynamically filled ..on its click i am showing value on radeditor.Its working fine in chrome .however, its not working as expected in internet explorer.please do needful as my further work is getting postponed.


below is my code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EmailEditortest.aspx.cs"
    Inherits="RPM.EmailEditortest" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadEditor runat="server" ID="RadEditor1" SkinID="DefaultSetOfTools" Font-Names="Tahoma"
            Font-Size="12px" Height="500px" OnClientLoad="RadEditorLoad" OnClientCommandExecuting="OnClientCommandExecuting">
            <ImageManager ViewPaths="~/Editor/Img/UserDir/Marketing,~/Editor/Img/UserDir/PublicRelations"
                UploadPaths="~/Editor/Img/UserDir/Marketing,~/Editor/Img/UserDir/PublicRelations"
                DeletePaths="~/Editor/Img/UserDir/Marketing,~/Editor/Img/UserDir/PublicRelations">
            </ImageManager>
        </telerik:RadEditor>
    </div>
    </form>
</body>
<script type="text/javascript">

    function RadEditorLoad(editor, eventArgs) {

        // Set the Editor Default Font to Arial

        editor.get_contentArea().style.fontFamily = 'Tahoma'
        editor.get_contentArea().style.fontSize = 12 + 'px';
    }

    function OnClientCommandExecuting(editor, args) {
        debugger;
        var name = args.get_name();
        var val = args.get_value();

        if (name == "emailFields") {
            editor.pasteHtml(val);
            //Cancel the further execution of the command as such a command does not exist in the editor command list
            args.set_cancel(true);
        }
    }
</script>
</html>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace RPM
{
    public partial class EmailEditortest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            EditorToolGroup dynamicToolbar = new EditorToolGroup();
            RadEditor1.Tools.Add(dynamicToolbar);

            EditorTool fndReplace = new EditorTool("FindAndReplace");
            EditorSeparator fSp = new EditorSeparator();
            EditorTool undo = new EditorTool("Undo");
            EditorTool redo = new EditorTool("Redo");
            EditorTool cut = new EditorTool("Cut");
            EditorTool copy = new EditorTool("Copy");
            EditorTool paste = new EditorTool("Paste");
            EditorTool bold = new EditorTool("Bold");
            EditorTool italic = new EditorTool("Italic");
            EditorTool underLine = new EditorTool("Underline");
            EditorTool ajxSplCheck = new EditorTool("AjaxSpellCheck");
            EditorSeparator jSp = new EditorSeparator();
            EditorTool justifyLeft = new EditorTool("JustifyLeft");
            EditorTool justifyCenter = new EditorTool("JustifyCenter");
            EditorTool justifyRight = new EditorTool("JustifyRight");
            EditorSeparator clSp = new EditorSeparator();
            EditorTool foreColor = new EditorTool("ForeColor");
            EditorTool backColor = new EditorTool("BackColor");
            EditorTool imageManager = new EditorTool("ImageManager");
            EditorTool documentManager = new EditorTool("DocumentManager");
            EditorTool linkManager = new EditorTool("LinkManager");
            EditorTool fontFamily = new EditorTool("FontName");
            EditorTool fontSize = new EditorTool("RealFontSize");
            EditorTool insertTable = new EditorTool("InsertTable");



            dynamicToolbar.Tools.Add(fndReplace);
            dynamicToolbar.Tools.Add(fSp);//seperator
            dynamicToolbar.Tools.Add(undo);
            dynamicToolbar.Tools.Add(redo);
            dynamicToolbar.Tools.Add(cut);
            dynamicToolbar.Tools.Add(copy);
            dynamicToolbar.Tools.Add(paste);
            dynamicToolbar.Tools.Add(bold);
            dynamicToolbar.Tools.Add(italic);
            dynamicToolbar.Tools.Add(underLine);
            dynamicToolbar.Tools.Add(ajxSplCheck);
            dynamicToolbar.Tools.Add(jSp);//seperator
            dynamicToolbar.Tools.Add(justifyLeft);
            dynamicToolbar.Tools.Add(justifyCenter);
            dynamicToolbar.Tools.Add(justifyRight);
            dynamicToolbar.Tools.Add(clSp);//seperator
            dynamicToolbar.Tools.Add(foreColor);
            dynamicToolbar.Tools.Add(backColor);
            dynamicToolbar.Tools.Add(imageManager);
            dynamicToolbar.Tools.Add(documentManager);
            dynamicToolbar.Tools.Add(linkManager);
            dynamicToolbar.Tools.Add(insertTable);
            dynamicToolbar.Tools.Add(fontFamily);
            dynamicToolbar.Tools.Add(fontSize);





            EditorDropDown ddn = new EditorDropDown("emailFields");
            ddn.Text = "Place Holder";

            ddn.Items.Add("parimal", "<%Parimal%>");
            ddn.Items.Add("sanjay", "<%sanjay%>");
            ddn.Items.Add("imran", "<%imran%>");
            ddn.Items.Add("parimal", "<%Parimal%>");
            dynamicToolbar.Tools.Add(ddn);
            
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 Feb 2013, 03:35 PM
Hello,

To fix the problem encode the opening < symbol in the value parameter with &lt;

    ddn.Items.Add("parimal", "&lt;%Parimal%>");
    ddn.Items.Add("sanjay", "&lt;%sanjay%>");
    ddn.Items.Add("imran", "&lt;%imran%>");
    ddn.Items.Add("parimal", "&lt;%Parimal%>");


Kind regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Editor
Asked by
Parimal
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or