<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>

<!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>
	<telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
	<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
		<Scripts>
			<%--Needed for JavaScript IntelliSense in VS2010--%>
			<%--For VS2008 replace RadScriptManager with ScriptManager--%>
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
		</Scripts>
	</telerik:RadScriptManager>
	<script type="text/javascript">
		//Put your JavaScript code here.
    </script>
	<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
	</telerik:RadAjaxManager>
	<div>
        <telerik:RadEditor ID="RadEditor1" runat="server" OnClientModeChange="OnClientModeChange">
        </telerik:RadEditor>

        <input type="hidden" id="editorContent" />

        <script type="text/javascript">
            var previousMode = 0;
            function OnClientModeChange(editor, args)
            {
                var mode = editor.get_mode();
                var originalContentField = $get("editorContent");
                var content = editor.get_html(true);

                switch (mode)
                {
                    case 1:
                        if (originalContentField.value != "" && previousMode == 4)
                            editor.set_html(originalContentField.value);
                        previousMode = mode;
                        break;
                    case 2:
                        if (originalContentField.value != "" && previousMode == 4)
                            editor.set_html(originalContentField.value);
                        previousMode = mode;
                        break;
                    case 4:

                        originalContentField.value = content;

                        content = content.toUpperCase();
                        editor.set_html(content);

                        previousMode = mode;
                        break;
                }                
            }
        </script>
	</div>
	</form>
</body>
</html>
