Hi,
I am using a MOSSradEditor inside the following control hirarchy:
Sharepoint Web part
- - - - Web user control
- - - - - - - - Rad Dock
- - - - - - - - - - - - MOSSRadEditor.
I would like to have ModeChange event of the MOSSRadEditor on the server side. For this purpose I handle the ClientModeChange event and then use RadAjaxManager to send the ajaxrequest to the server. But the method $find returns null in the line:
var
ajaxManager = $find(
"<%= RadAjaxManager1.ClientID %>"
);
Therefore I receive the javascript error Error: 'null' is null or not an object on the next line:
ajaxManager.ajaxRequest(operation);
Can you pleae let me know how I can solve this problem,
or proposing any pther way to have ModeChange event on the server side?
Here is the code section.
<%
@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditFormUI.ascx.cs"
Inherits="EditingTools.Core.EditFormUI" %>
<%
@ Register Assembly="Telerik.Web.UI, Version=2010.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%
@ Register Assembly="RadEditorSharePoint, Version=5.8.1.0, Culture=neutral, PublicKeyToken=1f131a624888eeed"
Namespace="Telerik.SharePoint" TagPrefix="telerikSP" %>
<
asp:ScriptManager ID="ScriptManager1" runat="server">
</
asp:ScriptManager>
<
telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
</
telerik:RadAjaxManager>
<
telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function ajaxRequest(operation) {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest(operation);
}
</script>
</
telerik:RadScriptBlock>
<
telerik:RadDockLayout ID="RadDockLayout1" runat="server">
<telerik:RadDockZone ID="dockZone" runat="server" Orientation="Vertical" Width="100%"
FitDocks="true">
<telerik:RadDock ID="dockAma" runat="server" >
<ContentTemplate>
<telerikSP:MOSSRadEditor ID="EditorAma" runat="server" OnClientModeChange="Editor_ModeChange">
<Content>
</Content>
</telerikSP:MOSSRadEditor>
</ContentTemplate>
</telerik:RadDock>
</telerik:RadDockZone>
</
telerik:RadDockLayout>
<
script type="text/javascript">
RadEditorCommandList[
"Save"] = function (commandName, editor, oTool) {
ajaxRequest(
"Save" );
}
RadEditorCommandList[
"Cancel"] = function (commandName, editor, oTool) {
ajaxRequest(
"Cancel");
}
function Editor_ModeChange(editor, args) {
var mode = editor.get_mode();
switch (mode) {
case 1:
ajaxRequest(
"Design" );
break;
case 4:
ajaxRequest(
"Preview" );
}
}
</
script>
Thank you in advance.