Hello, suppose for quick answer, because its critical for me, and i spend a lot of time to figure out of behaviour of you RadEditor.
I prepared example, and I'll describe bugs and issues with this control.
/// Default.aspx
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="RadeditorShowOnFocusBlurFocusAjax._Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
asp:Content
ID
=
"HeaderContent"
runat
=
"server"
ContentPlaceHolderID
=
"HeadContent"
>
</
asp:Content
>
<
asp:Content
ID
=
"BodyContent"
runat
=
"server"
ContentPlaceHolderID
=
"MainContent"
>
<
telerik:RadScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxMan"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxManagerProxy
ID
=
"RadAjaxProxy"
runat
=
"server"
>
</
telerik:RadAjaxManagerProxy
>
<
div
id
=
"reInput"
runat
=
"server"
style
=
"float:left; margin-right:100px;"
>
<
telerik:RadEditor
ContentAreaMode
=
"Div"
runat
=
"server"
ID
=
"RE"
SkinID
=
"DefaultSetOfTools"
Height
=
"200"
Width
=
"360"
ToolsWidth
=
"360"
OnClientLoad="EditorLoaded"<
br
>
OnClientCommandExecuting="EditorCmdExecuting"
OnClientCommandExecuted="EditorCmdExecuted">
</
telerik:RadEditor
>
</
div
>
<
div
id
=
"Result"
runat
=
"server"
>
<
h1
><
b
>Result</
b
></
h1
>
</
div
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
src
=
"Scripts/jquery-1.4.1.js"
type
=
"text/javascript"
></
script
>
<
script
type
=
"text/javascript"
>
function EditorLoaded (editor, args) {
var ajaxManager = $find("<%= RadAjaxMan.ClientID %>");
var element = document.all ? editor.get_document().body : editor.get_document();
$("#<%= Result.ClientID %>").html(editor.get_html());
ajaxManager.ajaxRequest(editor.get_html());
}
function EditorCmdExecuted (editor, args) {
// alert('some command executed');
var ajaxManager = $find("<%= RadAjaxMan.ClientID %>");
var element = document.all ? editor.get_document().body : editor.get_document();
$("#<%= Result.ClientID %>").html(editor.get_html());
ajaxManager.ajaxRequest(editor.get_html());
//EVEN THIS DOESn't Help!!!!!!!!!!!!!!!
editor.set_Focus();
editor.set_Focus();
}
function EditorCmdExecuting(editor){
}
$(document).ready(function () {
});
</
script
>
</
telerik:RadCodeBlock
>
</
asp:Content
>
///Default.aspx.cs
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;
using Telerik.Web.UI;
using Telerik.Web.UI.Editor;
namespace RadeditorShowOnFocusBlurFocusAjax {
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if(!IsPostBack)
{
ConfigureFloatRadEditor(RE);
}
Result.InnerHtml="result";
RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
}
protected void manager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
Result.InnerHtml="Somethis";
SaveSomething();
}
public void SaveSomething(){
//save this.
}
/// <
summary
>
/// Configure show on focus RadEditor
/// </
summary
>
/// <
param
name
=
"radEditor"
>Rad Editor Control</
param
>
private void ConfigureFloatRadEditor(RadEditor radEditor) {
ConfigureRadEditor(radEditor, "en-US");
radEditor.Tools.Clear();
EditorToolGroup formatBar = new EditorToolGroup();
formatBar.Tools.Add(new EditorTool("FontName"));
formatBar.Tools.Add(new EditorTool("RealFontSize"));
formatBar.Tools.Add(new EditorSeparator());
formatBar.Tools.Add(new EditorTool("Bold"));
formatBar.Tools.Add(new EditorTool("Italic"));
formatBar.Tools.Add(new EditorTool("Underline"));
formatBar.Tools.Add(new EditorSeparator());
formatBar.Tools.Add(new EditorTool("ForeColor"));
formatBar.Tools.Add(new EditorTool("JustifyLeft"));
formatBar.Tools.Add(new EditorTool("JustifyCenter"));
formatBar.Tools.Add(new EditorTool("JustifyRight"));
radEditor.Tools.Add(formatBar);
radEditor.ToolbarMode=EditorToolbarMode.ShowOnFocus;
}
public void ConfigureRadEditor(RadEditor radEditor, string contentLanguage) {
radEditor.StripFormattingOptions = EditorStripFormattingOptions.All;
radEditor.EditModes = EditModes.Design;
radEditor.EnableResize = false;
radEditor.NewLineMode = EditorNewLineModes.Div;
radEditor.Modules.Clear();
radEditor.Snippets.Clear();
radEditor.CssClasses.Clear();
radEditor.Links.Clear();
}
}
}
1. I need that, radeditor with ShowOnFocus get the same behavior as without ajax request. Because, after ajax request toolbar of radeditor dissapears, for example, on clicking on forecolor colorpicker or other split buttons in the toolbar. It disappears, after hotkeys pressed (for me its very critical), it disappears on enter, or after clicking any command - bold, italic etc. But without ajax request it works perfect.
2. I need ajax request on Blur event for whole radeditor, again it should works normaly.
3. In IE7-IE9 - selection of selected text disappears on clicking on forecolor command, so user can't to change color of text. Its already see on telerik's demo.
4. Very strange bug in FireFox - when user select whole text in editor, then apply "Bold", for example and after that clicks on alignment options - text in radeditor disappears.
Could you explain, how to fix this, and correctly implement?
I need ajax request on blur, on command executed, onclientload, on keyup. Please, help me with this.
Best regards, Misha.