PROBLEM AAAAHow to set the initial mode of the editor (Design, Html or Preview) and keep its state during postbacks?SOLUTION In the example below the mode of the editor is set from the value in a hidden field. You can change that value depending on the user and the RadEditor mode will be preserved during postbacks.
<%@ Page language="c#" Codebehind="onloadmode.aspx.cs" AutoEventWireup="false"%><%@ Register TagPrefix="radE" Namespace="Telerik.WebControls" Assembly="RadEditor" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML> <HEAD> <title>onloadmode</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD><body onload="RestoreEditorMode()" MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <radE:RadEditor OnClientSubmit = "SaveEditorMode" ID="editor1" Runat="server" SaveInFile="false" Editable="true"> some content</radE:RadEditor> <input runat="server" value="3" type="hidden" id="EditorHidden" NAME="EditorHidden"> </form><script>var input = document.getElementById("<%=EditorHidden.ClientID%>"); function SaveEditorMode(){ var editor = <%=editor1.ClientID%>; var oMode = editor.GetMode(); input.value = oMode;}
function RestoreEditorMode(){ var oMode = input.value; if ("" != oMode) { oMode = parseInt(oMode); var editor = <%=editor1.ClientID%>; var oFun = function() { editor.SetMode(oMode); } window.setTimeout(oFun, 100); }}
</script> </body></HTML>
Resources Buy Try